aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'js/controllers')
-rwxr-xr-xjs/controllers/color-controller.js14
-rwxr-xr-xjs/controllers/document-controller.js18
-rwxr-xr-xjs/controllers/elements/element-controller.js13
-rwxr-xr-xjs/controllers/elements/image-controller.js2
-rwxr-xr-xjs/controllers/elements/shapes-controller.js12
-rwxr-xr-xjs/controllers/elements/stage-controller.js2
6 files changed, 56 insertions, 5 deletions
diff --git a/js/controllers/color-controller.js b/js/controllers/color-controller.js
index e3b15f1c..a6e41dd3 100755
--- a/js/controllers/color-controller.js
+++ b/js/controllers/color-controller.js
@@ -322,7 +322,19 @@ exports.ColorController = Montage.create(Component, {
322 //Simple solid color 322 //Simple solid color
323 color = this.parseCssToColor(css); 323 color = this.parseCssToColor(css);
324 } 324 }
325 //Returning color object (or null if none) 325 // TODO - Hack for inconsistent color object -- some workflows set color.color and some color.value
326 if(color)
327 {
328 if(color.value && !color.color)
329 {
330 color.color = color.value;
331 }
332 else if(color.color && !color.value)
333 {
334 color.value = color.color;
335 }
336 }
337 //Returning color object (or null if none)
326 return color; 338 return color;
327 } 339 }
328 }, 340 },
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index f323ed99..6f7d098f 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -59,6 +59,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
59 this.eventManager.addEventListener("executeNewFile", this, false); 59 this.eventManager.addEventListener("executeNewFile", this, false);
60 this.eventManager.addEventListener("executeSave", this, false); 60 this.eventManager.addEventListener("executeSave", this, false);
61 this.eventManager.addEventListener("executeSaveAs", this, false); 61 this.eventManager.addEventListener("executeSaveAs", this, false);
62 this.eventManager.addEventListener("executeSaveAll", this, false);
62 63
63 this.eventManager.addEventListener("recordStyleChanged", this, false); 64 this.eventManager.addEventListener("recordStyleChanged", this, false);
64 65
@@ -85,8 +86,11 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
85 // 86 //
86 handleAppLoaded: { 87 handleAppLoaded: {
87 value: function() { 88 value: function() {
88 //Adding an intercept to resources loaded to ensure user assets load from cloud simulator 89 //Checking for app not to be loaded via http/https to add app only listener
89 chrome.webRequest.onBeforeRequest.addListener(this.handleWebRequest.bind(this), {urls: ["<all_urls>"]}, ["blocking"]); 90 if (window.location.protocol !== 'http:' && window.location.protocol !== 'https:') {
91 //Adding an intercept to resources loaded to ensure user assets load from cloud simulator
92 chrome.webRequest.onBeforeRequest.addListener(this.handleWebRequest.bind(this), {urls: ["<all_urls>"]}, ["blocking"]);
93 }
90 } 94 }
91 }, 95 },
92 //////////////////////////////////////////////////////////////////// 96 ////////////////////////////////////////////////////////////////////
@@ -130,6 +134,16 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
130 } 134 }
131 }, 135 },
132 //////////////////////////////////////////////////////////////////// 136 ////////////////////////////////////////////////////////////////////
137 //TODO: Check for appropiate structures
138 handleExecuteSaveAll: {
139 value: function(event) {
140 if((typeof this.activeDocument !== "undefined") && this.application.ninja.coreIoApi.cloudAvailable()){
141 //Text and HTML document classes should return the same save object for fileSave
142 this.application.ninja.ioMediator.fileSave(this.activeDocument.saveAll(), this.fileSaveResult.bind(this));
143 }
144 }
145 },
146 ////////////////////////////////////////////////////////////////////
133 handleExecuteSaveAs: { 147 handleExecuteSaveAs: {
134 value: function(event) { 148 value: function(event) {
135 var saveAsSettings = event._event.settings || {}; 149 var saveAsSettings = event._event.settings || {};
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js
index d6f2bc56..ec0335b4 100755
--- a/js/controllers/elements/element-controller.js
+++ b/js/controllers/elements/element-controller.js
@@ -122,6 +122,7 @@ var ElementController = exports.ElementController = Montage.create(NJComponent,
122 } 122 }
123 else 123 else
124 { 124 {
125 // TODO - Need to update border style and width also
125 el.elementModel.stroke = colorObj; 126 el.elementModel.stroke = colorObj;
126 } 127 }
127 128
@@ -166,10 +167,22 @@ var ElementController = exports.ElementController = Montage.create(NJComponent,
166 case 'gradient': 167 case 'gradient':
167 this.setProperty(el, "border-image", color.color.css); 168 this.setProperty(el, "border-image", color.color.css);
168 this.setProperty(el, "border-color", "none"); 169 this.setProperty(el, "border-color", "none");
170 if(color.borderInfo)
171 {
172 this.setProperty(el, "border-width", color.borderInfo.borderWidth +
173 color.borderInfo.borderUnits);
174 this.setProperty(el, "border-style", color.borderInfo.borderStyle);
175 }
169 break; 176 break;
170 default: 177 default:
171 this.setProperty(el, "border-image", "none"); 178 this.setProperty(el, "border-image", "none");
172 this.setProperty(el, "border-color", color.color.css); 179 this.setProperty(el, "border-color", color.color.css);
180 if(color.borderInfo)
181 {
182 this.setProperty(el, "border-width", color.borderInfo.borderWidth +
183 color.borderInfo.borderUnits);
184 this.setProperty(el, "border-style", color.borderInfo.borderStyle);
185 }
173 } 186 }
174 } 187 }
175 el.elementModel.stroke = color; 188 el.elementModel.stroke = color;
diff --git a/js/controllers/elements/image-controller.js b/js/controllers/elements/image-controller.js
index 5abce13e..25ca8da6 100755
--- a/js/controllers/elements/image-controller.js
+++ b/js/controllers/elements/image-controller.js
@@ -19,7 +19,7 @@ exports.ImageController = Montage.create(ElementController, {
19 return el.getAttribute(prop); 19 return el.getAttribute(prop);
20 break; 20 break;
21 default: 21 default:
22 return ElementController.getProperty(el, prop); 22 return ElementController.getProperty(el, prop, true);
23 } 23 }
24 } 24 }
25 }, 25 },
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index 15a18a51..e0bff70c 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -250,6 +250,10 @@ exports.ShapesController = Montage.create(CanvasController, {
250 setColor: { 250 setColor: {
251 value: function(el, color, isFill) { 251 value: function(el, color, isFill) {
252 var webGl = color.webGlColor || color.color.webGlColor; 252 var webGl = color.webGlColor || color.color.webGlColor;
253 if(!webGl)
254 {
255 webGl = this.application.ninja.colorController.colorModel.colorToWebGl(color.color);
256 }
253 if(isFill) 257 if(isFill)
254 { 258 {
255 el.elementModel.shapeModel.GLGeomObj.setFillColor(webGl); 259 el.elementModel.shapeModel.GLGeomObj.setFillColor(webGl);
@@ -261,6 +265,14 @@ exports.ShapesController = Montage.create(CanvasController, {
261 el.elementModel.shapeModel.GLGeomObj.setStrokeColor(webGl); 265 el.elementModel.shapeModel.GLGeomObj.setStrokeColor(webGl);
262 this.setShapeProperty(el, "stroke", webGl); 266 this.setShapeProperty(el, "stroke", webGl);
263 this.setShapeProperty(el, "border", color); 267 this.setShapeProperty(el, "border", color);
268 if(color.strokeInfo)
269 {
270 var strokeWidth = this.GetValueInPixels(color.strokeInfo.strokeSize,
271 color.strokeInfo.strokeUnits);
272 el.elementModel.shapeModel.GLGeomObj.setStrokeWidth(strokeWidth);
273 this.setShapeProperty(el, "strokeSize", color.strokeInfo.strokeSize + " "
274 + color.strokeInfo.strokeUnits);
275 }
264 } 276 }
265 el.elementModel.shapeModel.GLWorld.render(); 277 el.elementModel.shapeModel.GLWorld.render();
266 } 278 }
diff --git a/js/controllers/elements/stage-controller.js b/js/controllers/elements/stage-controller.js
index a8546662..abad3736 100755
--- a/js/controllers/elements/stage-controller.js
+++ b/js/controllers/elements/stage-controller.js
@@ -76,7 +76,7 @@ exports.StageController = Montage.create(ElementController, {
76 value: function(el, p) { 76 value: function(el, p) {
77 switch(p) { 77 switch(p) {
78 case "background" : 78 case "background" :
79 return el.elementModel.stageBackground.style.getProperty(p); 79 return this.application.ninja.colorController.getColorObjFromCss(el.elementModel.stageBackground.style.getProperty(p));
80 case "border": 80 case "border":
81 return el.elementModel.stageView.style.getProperty(p); 81 return el.elementModel.stageView.style.getProperty(p);
82 case "height": 82 case "height":