diff options
Diffstat (limited to 'js/controllers')
-rwxr-xr-x | js/controllers/document-controller.js | 26 | ||||
-rwxr-xr-x | js/controllers/elements/body-controller.js | 9 | ||||
-rwxr-xr-x | js/controllers/elements/controller-factory.js | 4 | ||||
-rwxr-xr-x | js/controllers/elements/element-controller.js | 102 | ||||
-rwxr-xr-x | js/controllers/elements/shapes-controller.js | 103 | ||||
-rwxr-xr-x | js/controllers/styles-controller.js | 4 |
6 files changed, 182 insertions, 66 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index a90375af..a3ebac24 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -174,9 +174,9 @@ exports.DocumentController = Montage.create(Component, { | |||
174 | handleExecuteSaveAll: { | 174 | handleExecuteSaveAll: { |
175 | value: function(event) { | 175 | value: function(event) { |
176 | // | 176 | // |
177 | if((typeof this.activeDocument !== "undefined") && this.application.ninja.coreIoApi.cloudAvailable()){ | 177 | if((typeof this.currentDocument !== "undefined") && this.application.ninja.coreIoApi.cloudAvailable()){ |
178 | // | 178 | // |
179 | this.activeDocument.model.saveAll(); | 179 | this.currentDocument.model.saveAll(); |
180 | } else { | 180 | } else { |
181 | //TODO: Add error handling | 181 | //TODO: Add error handling |
182 | } | 182 | } |
@@ -186,9 +186,9 @@ exports.DocumentController = Montage.create(Component, { | |||
186 | handleExecuteSaveAs: { | 186 | handleExecuteSaveAs: { |
187 | value: function(event) { | 187 | value: function(event) { |
188 | var saveAsSettings = event._event.settings || {}; | 188 | var saveAsSettings = event._event.settings || {}; |
189 | if((typeof this.activeDocument !== "undefined") && this.application.ninja.coreIoApi.cloudAvailable()){ | 189 | if((typeof this.currentDocument !== "undefined") && this.application.ninja.coreIoApi.cloudAvailable()){ |
190 | saveAsSettings.fileName = this.activeDocument.model.file.name; | 190 | saveAsSettings.fileName = this.currentDocument.model.file.name; |
191 | saveAsSettings.folderUri = this.activeDocument.model.file.uri.substring(0, this.activeDocument.model.file.uri.lastIndexOf("/")); | 191 | saveAsSettings.folderUri = this.currentDocument.model.file.uri.substring(0, this.currentDocument.model.file.uri.lastIndexOf("/")); |
192 | saveAsSettings.callback = this.saveAsCallback.bind(this); | 192 | saveAsSettings.callback = this.saveAsCallback.bind(this); |
193 | this.application.ninja.newFileController.showSaveAsDialog(saveAsSettings); | 193 | this.application.ninja.newFileController.showSaveAsDialog(saveAsSettings); |
194 | } | 194 | } |
@@ -204,9 +204,9 @@ exports.DocumentController = Montage.create(Component, { | |||
204 | //TODO: Is this used, should be cleaned up | 204 | //TODO: Is this used, should be cleaned up |
205 | handleExecuteFileCloseAll:{ | 205 | handleExecuteFileCloseAll:{ |
206 | value: function(event) { | 206 | value: function(event) { |
207 | if(this.activeDocument && this.application.ninja.coreIoApi.cloudAvailable()){ | 207 | if(this.currentDocument && this.application.ninja.coreIoApi.cloudAvailable()){ |
208 | while(this._documents.length > 0){ | 208 | while(this.currentDocument.length > 0){ |
209 | this.closeDocument(this._documents[this._documents.length -1].uuid); | 209 | this.closeDocument(this.currentDocument[this.currentDocument.length -1].uuid); |
210 | } | 210 | } |
211 | } | 211 | } |
212 | } | 212 | } |
@@ -291,19 +291,19 @@ exports.DocumentController = Montage.create(Component, { | |||
291 | value:function(saveAsDetails){ | 291 | value:function(saveAsDetails){ |
292 | var fileUri = null, filename = saveAsDetails.filename, destination = saveAsDetails.destination; | 292 | var fileUri = null, filename = saveAsDetails.filename, destination = saveAsDetails.destination; |
293 | //update document metadata | 293 | //update document metadata |
294 | this.activeDocument.name = ""+filename; | 294 | this.currentDocument.model.file.name = ""+filename; |
295 | //prepare new file uri | 295 | //prepare new file uri |
296 | if(destination && (destination.charAt(destination.length -1) !== "/")){ | 296 | if(destination && (destination.charAt(destination.length -1) !== "/")){ |
297 | destination = destination + "/"; | 297 | destination = destination + "/"; |
298 | } | 298 | } |
299 | fileUri = destination+filename; | 299 | fileUri = destination+filename; |
300 | 300 | ||
301 | this.activeDocument.uri = fileUri; | 301 | this.currentDocument.model.file.uri = fileUri; |
302 | //save a new file | 302 | //save a new file |
303 | //use the ioMediator.fileSaveAll when implemented | 303 | //use the ioMediator.fileSaveAll when implemented |
304 | this.activeDocument.model.file.name = filename; | 304 | this.currentDocument.model.file.name = filename; |
305 | this.activeDocument.model.file.uri = fileUri; | 305 | this.currentDocument.model.file.uri = fileUri; |
306 | this.activeDocument.model.save(); | 306 | this.currentDocument.model.save(); |
307 | } | 307 | } |
308 | }, | 308 | }, |
309 | 309 | ||
diff --git a/js/controllers/elements/body-controller.js b/js/controllers/elements/body-controller.js index 7a3a66f5..0dc11b82 100755 --- a/js/controllers/elements/body-controller.js +++ b/js/controllers/elements/body-controller.js | |||
@@ -30,7 +30,8 @@ exports.BodyController = Montage.create(ElementController, { | |||
30 | value: function(el, p) { | 30 | value: function(el, p) { |
31 | switch(p) { | 31 | switch(p) { |
32 | case "background" : | 32 | case "background" : |
33 | return this.application.ninja.colorController.getColorObjFromCss(this.application.ninja.stylesController.getElementStyle(el, "background-color", false, true)); | 33 | case "background-color": |
34 | return this.application.ninja.colorController.getColorObjFromCss(this.application.ninja.stylesController.getElementStyle(el, "background-color")); | ||
34 | case "border": | 35 | case "border": |
35 | return 0; | 36 | return 0; |
36 | case "height": | 37 | case "height": |
@@ -47,8 +48,8 @@ exports.BodyController = Montage.create(ElementController, { | |||
47 | setProperty: { | 48 | setProperty: { |
48 | value: function(el, p, value) { | 49 | value: function(el, p, value) { |
49 | switch(p) { | 50 | switch(p) { |
50 | case "body-background": | ||
51 | case "background": | 51 | case "background": |
52 | case "background-color": | ||
52 | this.application.ninja.stylesController.setElementStyle(el, "background-color", value); | 53 | this.application.ninja.stylesController.setElementStyle(el, "background-color", value); |
53 | break; | 54 | break; |
54 | case "overflow": | 55 | case "overflow": |
@@ -71,7 +72,7 @@ exports.BodyController = Montage.create(ElementController, { | |||
71 | 72 | ||
72 | getPerspectiveDist: { | 73 | getPerspectiveDist: { |
73 | value: function(el) { | 74 | value: function(el) { |
74 | if(el.elementModel && el.elementModel.props3D && el.elementModel.props3D.perspectiveDist) { | 75 | if(el.elementModel.props3D && el.elementModel.props3D.perspectiveDist) { |
75 | return el.elementModel.props3D.perspectiveDist; | 76 | return el.elementModel.props3D.perspectiveDist; |
76 | } else { | 77 | } else { |
77 | var dist = this.application.ninja.stylesController.getPerspectiveDistFromElement(el, true); | 78 | var dist = this.application.ninja.stylesController.getPerspectiveDistFromElement(el, true); |
@@ -83,7 +84,7 @@ exports.BodyController = Montage.create(ElementController, { | |||
83 | 84 | ||
84 | getMatrix: { | 85 | getMatrix: { |
85 | value: function(el) { | 86 | value: function(el) { |
86 | if(el.elementModel && el.elementModel.props3D && el.elementModel.props3D.matrix3d) | 87 | if(el.elementModel.props3D && el.elementModel.props3D.matrix3d) |
87 | { | 88 | { |
88 | return el.elementModel.props3D.matrix3d.slice(0); | 89 | return el.elementModel.props3D.matrix3d.slice(0); |
89 | } | 90 | } |
diff --git a/js/controllers/elements/controller-factory.js b/js/controllers/elements/controller-factory.js index 3ac3fe14..2d2a5cd1 100755 --- a/js/controllers/elements/controller-factory.js +++ b/js/controllers/elements/controller-factory.js | |||
@@ -8,7 +8,6 @@ var Montage = require("montage/core/core").Montage; | |||
8 | 8 | ||
9 | var BodyController = require("js/controllers/elements/body-controller").BodyController, | 9 | var BodyController = require("js/controllers/elements/body-controller").BodyController, |
10 | BlockController = require("js/controllers/elements/block-controller").BlockController, | 10 | BlockController = require("js/controllers/elements/block-controller").BlockController, |
11 | StageController = require("js/controllers/elements/stage-controller").StageController, | ||
12 | ShapesController = require("js/controllers/elements/shapes-controller").ShapesController, | 11 | ShapesController = require("js/controllers/elements/shapes-controller").ShapesController, |
13 | ImageController = require("js/controllers/elements/image-controller").ImageController, | 12 | ImageController = require("js/controllers/elements/image-controller").ImageController, |
14 | VideoController = require("js/controllers/elements/video-controller").VideoController, | 13 | VideoController = require("js/controllers/elements/video-controller").VideoController, |
@@ -27,7 +26,8 @@ exports.ControllerFactory = Montage.create(Montage, { | |||
27 | if(value.indexOf("block") !== -1) { | 26 | if(value.indexOf("block") !== -1) { |
28 | return BlockController; | 27 | return BlockController; |
29 | } else if(value.indexOf("stage") !== -1) { | 28 | } else if(value.indexOf("stage") !== -1) { |
30 | return StageController; | 29 | // return StageController; |
30 | alert("Calling the stage controller. Should not be calling this object"); | ||
31 | } else if(value.indexOf("body") !== -1) { | 31 | } else if(value.indexOf("body") !== -1) { |
32 | return BodyController; | 32 | return BodyController; |
33 | } else if(value.indexOf("shape") !== -1) { | 33 | } else if(value.indexOf("shape") !== -1) { |
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index 01e132d7..4a02e9a3 100755 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js | |||
@@ -5,7 +5,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
5 | </copyright> */ | 5 | </copyright> */ |
6 | 6 | ||
7 | var Montage = require("montage/core/core").Montage, | 7 | var Montage = require("montage/core/core").Montage, |
8 | Component = require("montage/ui/component").Component; | 8 | Component = require("montage/ui/component").Component, |
9 | njModule = require("js/lib/NJUtils"); | ||
9 | 10 | ||
10 | exports.ElementController = Montage.create(Component, { | 11 | exports.ElementController = Montage.create(Component, { |
11 | 12 | ||
@@ -36,7 +37,7 @@ exports.ElementController = Montage.create(Component, { | |||
36 | // Remove the element from the DOM and clear the GLWord. | 37 | // Remove the element from the DOM and clear the GLWord. |
37 | removeElement: { | 38 | removeElement: { |
38 | value: function(el) { | 39 | value: function(el) { |
39 | if(el.elementModel && el.elementModel.shapeModel && el.elementModel.shapeModel.GLWorld) { | 40 | if(el.elementModel.shapeModel && el.elementModel.shapeModel.GLWorld) { |
40 | el.elementModel.shapeModel.GLWorld.clearTree(); | 41 | el.elementModel.shapeModel.GLWorld.clearTree(); |
41 | } | 42 | } |
42 | el.parentNode.removeChild(el); | 43 | el.parentNode.removeChild(el); |
@@ -162,28 +163,12 @@ exports.ElementController = Montage.create(Component, { | |||
162 | el.elementModel.stroke = null; | 163 | el.elementModel.stroke = null; |
163 | return; | 164 | return; |
164 | case 'gradient': | 165 | case 'gradient': |
165 | if(color.borderInfo) { | ||
166 | if(color.borderInfo.borderWidth) { | ||
167 | this.setProperty(el, "border-width", color.borderInfo.borderWidth + color.borderInfo.borderUnits); | ||
168 | } | ||
169 | if(color.borderInfo.borderStyle) { | ||
170 | this.setProperty(el, "border-style", color.borderInfo.borderStyle); | ||
171 | } | ||
172 | } | ||
173 | this.setGradientBorder(el, color.color.gradientMode, color.color.css); | 166 | this.setGradientBorder(el, color.color.gradientMode, color.color.css); |
174 | break; | 167 | break; |
175 | default: | 168 | default: |
176 | this.setProperty(el, "border-image", "none"); | 169 | this.setProperty(el, "border-image", "none"); |
177 | this.setProperty(el, "border-image-slice", ""); | 170 | this.setProperty(el, "border-image-slice", ""); |
178 | this.setProperty(el, "border-color", color.color.css); | 171 | this.setProperty(el, "border-color", color.color.css); |
179 | if(color.borderInfo) { | ||
180 | if(c |