diff options
author | Eric Guzman | 2012-03-29 16:29:04 -0700 |
---|---|---|
committer | Eric Guzman | 2012-03-29 16:29:04 -0700 |
commit | ccd57d8610a7839cf14b2c9e354b64acf53093a7 (patch) | |
tree | f11b4418483fd21831b72ca6dc0451422a25bfe2 /js/controllers | |
parent | 7aefa059c79c9bef5c7a8a93cdfbd1ce55f69118 (diff) | |
parent | f4949cab544886702e7ad6eeaa6215125c7b067a (diff) | |
download | ninja-ccd57d8610a7839cf14b2c9e354b64acf53093a7.tar.gz |
Merge branch 'refs/heads/master' into PresetsPI
Diffstat (limited to 'js/controllers')
-rwxr-xr-x | js/controllers/color-controller.js | 4 | ||||
-rwxr-xr-x | js/controllers/document-controller.js | 26 | ||||
-rwxr-xr-x | js/controllers/elements/shapes-controller.js | 66 |
3 files changed, 91 insertions, 5 deletions
diff --git a/js/controllers/color-controller.js b/js/controllers/color-controller.js index 8e000b19..c6d664cf 100755 --- a/js/controllers/color-controller.js +++ b/js/controllers/color-controller.js | |||
@@ -227,14 +227,14 @@ exports.ColorController = Montage.create(Component, { | |||
227 | // | 227 | // |
228 | this.fill = color; | 228 | this.fill = color; |
229 | // | 229 | // |
230 | if(e._event.wasSetByCode && mode !== 'nocolor') return; | 230 | if(e._event.wasSetByCode) return; |
231 | // | 231 | // |
232 | this.setColor(mode, color, true); | 232 | this.setColor(mode, color, true); |
233 | } else if (input === 'stroke') { | 233 | } else if (input === 'stroke') { |
234 | // | 234 | // |
235 | this.stroke = color; | 235 | this.stroke = color; |
236 | // | 236 | // |
237 | if(e._event.wasSetByCode && mode !== 'nocolor') return; | 237 | if(e._event.wasSetByCode) return; |
238 | 238 | ||
239 | this.setColor(mode, color, false); | 239 | this.setColor(mode, color, false); |
240 | } | 240 | } |
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index d5556fa8..a308f191 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -32,22 +32,30 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
32 | _iframeHolder: { value: null, enumerable: false }, | 32 | _iframeHolder: { value: null, enumerable: false }, |
33 | _textHolder: { value: null, enumerable: false }, | 33 | _textHolder: { value: null, enumerable: false }, |
34 | _codeMirrorCounter: {value: 1, enumerable: false}, | 34 | _codeMirrorCounter: {value: 1, enumerable: false}, |
35 | |||
36 | canSave:{value: false},//for Save menu state update | ||
37 | canSaveAll:{value: false},//for Save All menu state update | ||
35 | 38 | ||
36 | activeDocument: { | 39 | activeDocument: { |
37 | get: function() { | 40 | get: function() { |
38 | return this._activeDocument; | 41 | return this._activeDocument; |
39 | }, | 42 | }, |
40 | set: function(doc) { | 43 | set: function(doc) { |
41 | if(!!this._activeDocument) this._activeDocument.isActive = false; | 44 | if(!!this._activeDocument){ this._activeDocument.isActive = false;} |
42 | |||
43 | this._activeDocument = doc; | 45 | this._activeDocument = doc; |
44 | if(!!this._activeDocument){ | 46 | if(!!this._activeDocument){ |
45 | |||
46 | if(this._documents.indexOf(doc) === -1) this._documents.push(doc); | 47 | if(this._documents.indexOf(doc) === -1) this._documents.push(doc); |
47 | this._activeDocument.isActive = true; | 48 | this._activeDocument.isActive = true; |
49 | |||
48 | if(!!this._activeDocument.editor){ | 50 | if(!!this._activeDocument.editor){ |
49 | this._activeDocument.editor.focus(); | 51 | this._activeDocument.editor.focus(); |
50 | } | 52 | } |
53 | |||
54 | this.canSave = doc.needsSave; | ||
55 | this.canSaveAll = doc.needsSave; | ||
56 | }else{ | ||
57 | this.canSave = false; | ||
58 | this.canSaveAll = false; | ||
51 | } | 59 | } |
52 | } | 60 | } |
53 | }, | 61 | }, |
@@ -61,6 +69,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
61 | this.eventManager.addEventListener("executeSaveAs", this, false); | 69 | this.eventManager.addEventListener("executeSaveAs", this, false); |
62 | this.eventManager.addEventListener("executeSaveAll", this, false); | 70 | this.eventManager.addEventListener("executeSaveAll", this, false); |
63 | this.eventManager.addEventListener("executeFileClose", this, false); | 71 | this.eventManager.addEventListener("executeFileClose", this, false); |
72 | this.eventManager.addEventListener("executeFileCloseAll", this, false); | ||
64 | 73 | ||
65 | this.eventManager.addEventListener("styleSheetDirty", this, false); | 74 | this.eventManager.addEventListener("styleSheetDirty", this, false); |
66 | 75 | ||
@@ -180,6 +189,17 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
180 | } | 189 | } |
181 | }, | 190 | }, |
182 | //////////////////////////////////////////////////////////////////// | 191 | //////////////////////////////////////////////////////////////////// |
192 | handleExecuteFileCloseAll:{ | ||
193 | value: function(event) { | ||
194 | var i=0; | ||
195 | if(this.activeDocument && this.application.ninja.coreIoApi.cloudAvailable()){ | ||
196 | while(this._documents.length > 0){ | ||
197 | this.closeDocument(this._documents[this._documents.length -1].uuid); | ||
198 | } | ||
199 | } | ||
200 | } | ||
201 | }, | ||
202 | //////////////////////////////////////////////////////////////////// | ||
183 | // | 203 | // |
184 | fileSaveResult: { | 204 | fileSaveResult: { |
185 | value: function (result) { | 205 | value: function (result) { |
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index 5b9e4672..ef453bea 100755 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js | |||
@@ -119,6 +119,31 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
119 | el.elementModel.shapeModel.GLWorld._canvas.task.stop(); | 119 | el.elementModel.shapeModel.GLWorld._canvas.task.stop(); |
120 | } | 120 | } |
121 | break; | 121 | break; |
122 | case "strokeHardness": | ||
123 | this.setShapeProperty(el, "strokeHardness", value); | ||
124 | el.elementModel.shapeModel.GLGeomObj.setStrokeHardness(val); | ||
125 | el.elementModel.shapeModel.GLWorld.render(); | ||
126 | break; | ||
127 | case "strokeSmoothing": | ||
128 | this.setShapeProperty(el, "strokeSmoothing", value); | ||
129 | el.elementModel.shapeModel.GLGeomObj.setSmoothingAmount(val); | ||
130 | el.elementModel.shapeModel.GLWorld.render(); | ||
131 | break; | ||
132 | case "doSmoothing": | ||
133 | this.setShapeProperty(el, "doSmoothing", value); | ||
134 | el.elementModel.shapeModel.GLGeomObj.setDoSmoothing(value); | ||
135 | el.elementModel.shapeModel.GLWorld.render(); | ||
136 | break; | ||
137 | case "isCalligraphic": | ||
138 | this.setShapeProperty(el, "isCalligraphic", value); | ||
139 | el.elementModel.shapeModel.GLGeomObj.setStrokeUseCalligraphic(value); | ||
140 | el.elementModel.shapeModel.GLWorld.render(); | ||
141 | break; | ||
142 | case "strokeAngle": | ||
143 | this.setShapeProperty(el, "strokeAngle", value); | ||
144 | el.elementModel.shapeModel.GLGeomObj.setStrokeAngle(Math.PI * val/180); | ||
145 | el.elementModel.shapeModel.GLWorld.render(); | ||
146 | break; | ||
122 | default: | 147 | default: |
123 | CanvasController.setProperty(el, p, value); | 148 | CanvasController.setProperty(el, p, value); |
124 | } | 149 | } |
@@ -139,6 +164,43 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
139 | case "useWebGl": | 164 | case "useWebGl": |
140 | case "animate": | 165 | case "animate": |
141 | return this.getShapeProperty(el, p); | 166 | return this.getShapeProperty(el, p); |
167 | case "strokeHardness": | ||
168 | if (el.elementModel && el.elementModel.shapeModel){ | ||
169 | return el.elementModel.shapeModel.GLGeomObj.getStrokeHardness(); | ||
170 | } else { | ||
171 | return null; | ||
172 | } | ||
173 | break; | ||
174 | case "doSmoothing": | ||
175 | if (el.elementModel && el.elementModel.shapeModel){ | ||
176 | return el.elementModel.shapeModel.GLGeomObj.getDoSmoothing(); | ||
177 | } else { | ||
178 | return null; | ||
179 | } | ||
180 | break; | ||
181 | case "strokeSmoothing": | ||
182 | if (el.elementModel && el.elementModel.shapeModel){ | ||
183 | return el.elementModel.shapeModel.GLGeomObj.getSmoothingAmount(); | ||
184 | } else { | ||
185 | return null; | ||
186 | } | ||
187 | break; | ||
188 | case "isCalligraphic": | ||
189 | if (el.elementModel && el.elementModel.shapeModel){ | ||
190 | return el.elementModel.shapeModel.GLGeomObj.getStrokeUseCalligraphic(); | ||
191 | } else { | ||
192 | return null; | ||
193 | } | ||
194 | break; | ||
195 | case "strokeAngle": | ||
196 | if (el.elementModel && el.elementModel.shapeModel){ | ||
197 | return 180*el.elementModel.shapeModel.GLGeomObj.getStrokeAngle()/Math.PI; | ||
198 | } else { | ||
199 | return null; | ||
200 | } | ||
201 | break; | ||
202 | |||
203 | |||
142 | case "strokeMaterial": | 204 | case "strokeMaterial": |
143 | case "fillMaterial": | 205 | case "fillMaterial": |
144 | var m = this.getShapeProperty(el, p); | 206 | var m = this.getShapeProperty(el, p); |
@@ -274,6 +336,10 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
274 | color = this.getShapeProperty(el, "stroke"); | 336 | color = this.getShapeProperty(el, "stroke"); |
275 | } | 337 | } |
276 | 338 | ||
339 | if(!css) { | ||
340 | return null; | ||
341 | } | ||
342 | |||
277 | css = this.application.ninja.colorController.colorModel.webGlToCss(color); | 343 | css = this.application.ninja.colorController.colorModel.webGlToCss(color); |
278 | return this.application.ninja.colorController.getColorObjFromCss(css); | 344 | return this.application.ninja.colorController.getColorObjFromCss(css); |
279 | } | 345 | } |