aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Guzman2012-08-20 14:54:44 -0700
committerEric Guzman2012-08-20 14:54:44 -0700
commit1e9d019867ff90840735ec531af5ebec9c7962e6 (patch)
tree887d28987a3113e84c771e264767c9462e9a8844
parenta34663e154af834176b758b6da368f634cd2a6bd (diff)
parent36d692a9fb216f2785a570d13c1beb27360c7305 (diff)
downloadninja-1e9d019867ff90840735ec531af5ebec9c7962e6.tar.gz
Merge branch 'refs/heads/master' into minorFixes_7.1
-rwxr-xr-xjs/components/layout/document-bar.reel/document-bar.css2
-rwxr-xr-xjs/components/layout/document-bar.reel/document-bar.js4
-rwxr-xr-xjs/components/tools-properties/shape-properties.reel/shape-properties.html2
-rwxr-xr-xjs/components/tools-properties/shape-properties.reel/shape-properties.js2
-rwxr-xr-xjs/controllers/selection-controller.js4
-rwxr-xr-xjs/controllers/styles-controller.js2
-rwxr-xr-xjs/data/pi/pi-data.js2
-rwxr-xr-xjs/document/document-html.js8
-rw-r--r--js/io/system/chromeapi.js19
-rwxr-xr-xjs/lib/geom/circle.js94
-rwxr-xr-xjs/lib/geom/line.js13
-rwxr-xr-xjs/lib/geom/rectangle.js2
-rwxr-xr-xjs/panels/Panel.reel/Panel.js13
-rwxr-xr-xjs/stage/layout.js2
-rwxr-xr-xjs/tools/LineTool.js56
-rwxr-xr-xjs/tools/Translate3DToolBase.js4
-rwxr-xr-xjs/tools/TranslateObject3DTool.js19
-rw-r--r--tests/unit-tests/color-model-test.js130
-rw-r--r--tests/unit-tests/file-io-test.js610
-rw-r--r--tests/unit-tests/styles-controller-test.js143
20 files changed, 1029 insertions, 102 deletions
diff --git a/js/components/layout/document-bar.reel/document-bar.css b/js/components/layout/document-bar.reel/document-bar.css
index 5eba72e8..2c547a22 100755
--- a/js/components/layout/document-bar.reel/document-bar.css
+++ b/js/components/layout/document-bar.reel/document-bar.css
@@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
33 background: -webkit-radial-gradient(center, ellipse cover, rgba(100, 100, 100, .9) 40%, rgba(100, 100, 100, .4) 50%, rgba(100, 100, 100, 0) 51%), -webkit-radial-gradient(center, ellipse cover, rgba(100, 100, 100, .9) 40%, rgba(100, 100, 100, .4) 50%, rgba(100, 100, 100, 0) 51%), -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgb(60, 60, 60)), color-stop(70%, rgb(30, 30, 30)), color-stop(100%, rgb(25, 25, 25))), -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgb(10, 10, 10)), color-stop(50%, rgb(20, 20, 20)), color-stop(100%, rgb(10, 10, 10))) !important; 33 background: -webkit-radial-gradient(center, ellipse cover, rgba(100, 100, 100, .9) 40%, rgba(100, 100, 100, .4) 50%, rgba(100, 100, 100, 0) 51%), -webkit-radial-gradient(center, ellipse cover, rgba(100, 100, 100, .9) 40%, rgba(100, 100, 100, .4) 50%, rgba(100, 100, 100, 0) 51%), -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgb(60, 60, 60)), color-stop(70%, rgb(30, 30, 30)), color-stop(100%, rgb(25, 25, 25))), -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgb(10, 10, 10)), color-stop(50%, rgb(20, 20, 20)), color-stop(100%, rgb(10, 10, 10))) !important;
34 background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat !important; 34 background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat !important;
35 background-position: 49.5% center, 50.5% center, center center, left top !important; 35 background-position: 49.5% center, 50.5% center, center center, left top !important;
36 background-size: 5px 5px, 5px 5px, 3% 100%, 100% 100%; 36 background-size: 5px 5px, 5px 5px, 3% 100%, 100% 100% !important;
37} 37}
38 38
39.documentBar { 39.documentBar {
diff --git a/js/components/layout/document-bar.reel/document-bar.js b/js/components/layout/document-bar.reel/document-bar.js
index 098e9e68..88c4a24b 100755
--- a/js/components/layout/document-bar.reel/document-bar.js
+++ b/js/components/layout/document-bar.reel/document-bar.js
@@ -246,7 +246,7 @@ exports.DocumentBar = Montage.create(Component, {
246 file: this._currentDocument.model.file, 246 file: this._currentDocument.model.file,
247 webgl: this._currentDocument.model.webGlHelper.glData, 247 webgl: this._currentDocument.model.webGlHelper.glData,
248 styles: this._currentDocument.model.getStyleSheets(), 248 styles: this._currentDocument.model.getStyleSheets(),
249 template: this._currentDocument.fileTemplate, 249 template: this._currentDocument.model.fileTemplate,
250 document: this._currentDocument.model.views.design.iframe.contentWindow.document, 250 document: this._currentDocument.model.views.design.iframe.contentWindow.document,
251 head: this._currentDocument.model.views.design.iframe.contentWindow.document.head, 251 head: this._currentDocument.model.views.design.iframe.contentWindow.document.head,
252 body: this._currentDocument.model.views.design.iframe.contentWindow.document.body, 252 body: this._currentDocument.model.views.design.iframe.contentWindow.document.body,
@@ -256,7 +256,7 @@ exports.DocumentBar = Montage.create(Component, {
256 doc = this._currentDocument.model.views.code.textArea.value; 256 doc = this._currentDocument.model.views.code.textArea.value;
257 } 257 }
258 //Reloading the document from changes made 258 //Reloading the document from changes made
259 this._currentDocument.reloadView(view, this.fileTemplate, doc); 259 this._currentDocument.reloadView(view, doc.template, doc);
260 } 260 }
261 } 261 }
262 }, 262 },
diff --git a/js/components/tools-properties/shape-properties.reel/shape-properties.html b/js/components/tools-properties/shape-properties.reel/shape-properties.html
index 7503f257..959feec6 100755
--- a/js/components/tools-properties/shape-properties.reel/shape-properties.html
+++ b/js/components/tools-properties/shape-properties.reel/shape-properties.html
@@ -66,7 +66,7 @@ POSSIBILITY OF SUCH DAMAGE.
66 "prototype": "js/components/hottextunit.reel[HotTextUnit]", 66 "prototype": "js/components/hottextunit.reel[HotTextUnit]",
67 "properties": { 67 "properties": {
68 "element": {"#": "strokeControl"}, 68 "element": {"#": "strokeControl"},
69 "minValue": 1, 69 "minValue": 0,
70 "maxValue": 100, 70 "maxValue": 100,
71 "value": 1, 71 "value": 1,
72 "decimalPlace": 10, 72 "decimalPlace": 10,
diff --git a/js/components/tools-properties/shape-properties.reel/shape-properties.js b/js/components/tools-properties/shape-properties.reel/shape-properties.js
index 40ad0dd0..c5b22188 100755
--- a/js/components/tools-properties/shape-properties.reel/shape-properties.js
+++ b/js/components/tools-properties/shape-properties.reel/shape-properties.js
@@ -209,12 +209,14 @@ var ShapeProperties = exports.ShapeProperties = Montage.create(ToolProperties, {
209 this._fillColorCtrlIcon.style["display"] = "none"; 209 this._fillColorCtrlIcon.style["display"] = "none";
210 this._fillColorCtrlIcon.visible = false; 210 this._fillColorCtrlIcon.visible = false;
211 this.endDivider.style["display"] = "none"; 211 this.endDivider.style["display"] = "none";
212 this._strokeSize.minValue = 1;
212 } else { 213 } else {
213 this._fillColorCtrlContainer.style["display"] = ""; 214 this._fillColorCtrlContainer.style["display"] = "";
214 this._fillColorCtrlContainer.visible = true; 215 this._fillColorCtrlContainer.visible = true;
215 this._fillColorCtrlIcon.style["display"] = ""; 216 this._fillColorCtrlIcon.style["display"] = "";
216 this._fillColorCtrlIcon.visible = true; 217 this._fillColorCtrlIcon.visible = true;
217 this.endDivider.style["display"] = ""; 218 this.endDivider.style["display"] = "";
219 this._strokeSize.minValue = 0;
218 } 220 }
219 221
220 if (this._useWebGL.checked) { 222 if (this._useWebGL.checked) {
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js
index 7a26ed3b..4b031d70 100755
--- a/js/controllers/selection-controller.js
+++ b/js/controllers/selection-controller.js
@@ -58,13 +58,13 @@ exports.SelectionController = Montage.create(Component, {
58 return; 58 return;
59 } 59 }
60 60
61 if(this._currentDocument && this._currentDocument.currentView === "design") { 61 if(this._currentDocument && (this._currentDocument.currentView === "design" || this._currentDocument.model.currentView.identifier !== "code")) {
62 this._currentDocument.model._selection = this.application.ninja.selectedElements; 62 this._currentDocument.model._selection = this.application.ninja.selectedElements;
63 } 63 }
64 64
65 this._currentDocument = value; 65 this._currentDocument = value;
66 66
67 if(this._currentDocument && this._currentDocument.currentView === "design") { 67 if(this._currentDocument && (this._currentDocument.currentView === "design" || this._currentDocument.model.currentView.identifier !== "code")) {
68 this.selectedElements = this._currentDocument.model.selection; 68 this.selectedElements = this._currentDocument.model.selection;
69 } 69 }
70 /* 70 /*
diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js
index e95c6614..68d031fb 100755
--- a/js/controllers/styles-controller.js
+++ b/js/controllers/styles-controller.js
@@ -87,7 +87,7 @@ var stylesController = exports.StylesController = Montage.create(Component, {
87 set : function(document) { 87 set : function(document) {
88 ///// If the document is null set default stylesheets to null 88 ///// If the document is null set default stylesheets to null
89 89
90 if(!document || document.currentView === "code") { 90 if(!document || (document.currentView === "code" && document.model.currentView.identifier !== "design-code")) {
91 this._currentDocument = null; 91 this._currentDocument = null;
92 this._stageStylesheet = null; 92 this._stageStylesheet = null;
93 this.defaultStylesheet = null; 93 this.defaultStylesheet = null;
diff --git a/js/data/pi/pi-data.js b/js/data/pi/pi-data.js
index f36f11e6..489938d5 100755
--- a/js/data/pi/pi-data.js
+++ b/js/data/pi/pi-data.js
@@ -499,7 +499,7 @@ exports.PiData = Montage.create( Montage, {
499 prop : "strokeSize", 499 prop : "strokeSize",
500 label : "Stroke", 500 label : "Stroke",
501 inputFunction: parseFloat, 501 inputFunction: parseFloat,
502 min : 0, 502 min : 1,
503 max : 100, 503 max : 100,
504 value : 1, 504 value : 1,
505 unit : "px", 505 unit : "px",
diff --git a/js/document/document-html.js b/js/document/document-html.js
index f3163339..d610c69d 100755
--- a/js/document/document-html.js
+++ b/js/document/document-html.js
@@ -157,6 +157,14 @@ exports.HtmlDocument = Montage.create(Component, {
157 this.model.views.design.show(); 157 this.model.views.design.show();
158 this.model.views.design.iframe.style.opacity = 0; 158 this.model.views.design.iframe.style.opacity = 0;
159 this.model.views.design.content = this.application.ninja.ioMediator.tmplt.parseHtmlToNinjaTemplate(doc); 159 this.model.views.design.content = this.application.ninja.ioMediator.tmplt.parseHtmlToNinjaTemplate(doc);
160 //
161 if (!template) {
162 if (this.model.views.design.content.body.indexOf('Ninja-Banner Dimensions@@@') !== -1) {
163 dimensions = (this.model.views.design.content.body.split('Ninja-Banner Dimensions@@@'))[1].split('-->')[0].split('x');
164 dimensions = {width: parseInt(dimensions[0]), height: parseInt(dimensions[1])};
165 template = {type: 'banner', size: dimensions};
166 }
167 }
160 //TODO: Improve reference (probably through binding values) 168 //TODO: Improve reference (probably through binding values)
161 this.model.views.design._webGlHelper = this.model.webGlHelper; 169 this.model.views.design._webGlHelper = this.model.webGlHelper;
162 //Rendering design view, using observers to know when template is ready 170 //Rendering design view, using observers to know when template is ready
diff --git a/js/io/system/chromeapi.js b/js/io/system/chromeapi.js
index e33406ee..b13dd9de 100644
--- a/js/io/system/chromeapi.js
+++ b/js/io/system/chromeapi.js
@@ -96,7 +96,7 @@ exports.ChromeApi = Montage.create(Object.prototype, {
96 // 96 //
97 f.createWriter(function(writer) { 97 f.createWriter(function(writer) {
98 // 98 //
99 var mime, blob, type = filePath.split('.'); 99 var mime, blob, type = filePath.split('.'), version = parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10);
100 type = type[type.length-1]; 100 type = type[type.length-1];
101 switch (type) { 101 switch (type) {
102 case 'bmp': 102 case 'bmp':
@@ -136,8 +136,12 @@ exports.ChromeApi = Montage.create(Object.prototype, {
136 mime = 'text/'+type; 136 mime = 'text/'+type;
137 break; 137 break;
138 } 138 }
139 // 139 //TODO: Remove version checking once Chrome version 22 is stable
140 blob = new Blob([content], {type: type}); 140 if (version > 21) {
141 blob = new Blob([new Uint8Array(content)], {type: type});
142 } else {
143 blob = new Blob([content], {type: type});
144 }
141 // 145 //
142 writer.write(blob); 146 writer.write(blob);