aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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/controllers/selection-controller.js4
-rwxr-xr-xjs/controllers/styles-controller.js2
-rwxr-xr-xjs/document/document-html.js8
-rw-r--r--js/io/system/chromeapi.js19
-rwxr-xr-xjs/lib/geom/line.js13
-rwxr-xr-xjs/panels/Panel.reel/Panel.js13
-rwxr-xr-xjs/stage/layout.js2
-rwxr-xr-xjs/tools/LineTool.js56
-rw-r--r--manifest.json2
11 files changed, 84 insertions, 41 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/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/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);
143 // 147 //
@@ -166,10 +170,15 @@ exports.ChromeApi = Montage.create(Object.prototype, {
166 // 170 //
167 this.fileSystem.root.getFile(filePath, {}, function(f) { 171 this.fileSystem.root.getFile(filePath, {}, function(f) {
168 f.file(function(file) { 172 f.file(function(file) {
169 var reader = new FileReader(); 173 var reader = new FileReader(), version = parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10);
170 reader.onloadend = function(e) { 174 reader.onloadend = function(e) {
171 if (callback) { 175 if (callback) {
172 callback({content: this.result, data: file, file: f, url: f.toURL()}); 176 //TODO: Remove version checking once Chrome version 22 is stable
177 if (version > 21) {
178 callback({content: new Uint8Array(this.result), data: file, file: f, url: f.toURL()});
179 } else {
180 callback({content: this.result, data: file, file: f, url: f.toURL()});
181 }
173 } 182 }
174 }; 183 };
175 reader.readAsArrayBuffer(file); 184 reader.readAsArrayBuffer(file);
diff --git a/js/lib/geom/line.js b/js/lib/geom/line.js
index eec4f6d9..df65ee86 100755
--- a/js/lib/geom/line.js
+++ b/js/lib/geom/line.js
@@ -537,6 +537,15 @@ exports.Line = Object.create(GeomObj, {
537 ctx.strokeStyle = c; 537 ctx.strokeStyle = c;
538 } 538 }
539 539
540 var viewUtils = require("js/helper-classes/3D/view-utils").ViewUtils;
541 viewUtils.pushViewportObj( world.getCanvas() );
542 var cop = viewUtils.getCenterOfProjection();
543 viewUtils.popViewportObj();
544 var xCtr = cop[0] + this._xOffset, yCtr = cop[1] - this._yOffset;
545 var xLeft = xCtr - 0.5*this.getWidth(), yTop = yCtr - 0.5*this.getHeight();
546 var xDist = cop[0] - xLeft, yDist = cop[1] - yTop;
547 var xOff = 0.5*world.getViewportWidth() - xDist, yOff = 0.5*world.getViewportHeight() - yDist;
548
540 // get the points 549 // get the points
541 var p0, p1; 550 var p0, p1;
542 if(this._slope === "vertical") { 551 if(this._slope === "vertical") {
@@ -554,8 +563,8 @@ exports.Line = Object.create(GeomObj, {
554 } 563 }
555 564
556 // draw the line 565 // draw the line
557 ctx.moveTo( p0[0], p0[1] ); 566 ctx.moveTo( p0[0]+xOff, p0[1]+yOff );
558 ctx.lineTo( p1[0], p1[1] ); 567 ctx.lineTo( p1[0]+xOff, p1[1]+yOff );
559 ctx.stroke(); 568 ctx.stroke();
560 } 569 }
561 } 570 }
diff --git a/js/panels/Panel.reel/Panel.js b/js/panels/Panel.reel/Panel.js
index 988088e3..586636e1 100755
--- a/js/panels/Panel.reel/Panel.js
+++ b/js/panels/Panel.reel/Panel.js
@@ -159,11 +159,24 @@ exports.Panel = Montage.create(Component, {
159 this.disabled = true; 159 this.disabled = true;
160 } else { 160 } else {
161 this.disabled = this._currentDocument.currentView !== "design"; 161 this.disabled = this._currentDocument.currentView !== "design";
162 this._currentDocument.addPropertyChangeListener("model.currentViewIdentifier", this, false);
162 } 163 }
163 164
164 } 165 }
165 }, 166 },
166 167
168 handleChange: {
169 value: function(notification) {
170 if(notification.currentPropertyPath === "model.currentViewIdentifier") {
171 if(this.currentDocument.model.currentView.identifier === "design-code") {
172 this.disabled = true;
173 } else {
174 this.disabled = false;
175