diff options
Diffstat (limited to 'js/controllers')
-rwxr-xr-x | js/controllers/color-controller.js | 5 | ||||
-rwxr-xr-x | js/controllers/document-controller.js | 14 | ||||
-rwxr-xr-x | js/controllers/elements/component-controller.js | 13 | ||||
-rwxr-xr-x | js/controllers/elements/element-controller.js | 16 | ||||
-rwxr-xr-x | js/controllers/elements/shapes-controller.js | 56 | ||||
-rwxr-xr-x | js/controllers/elements/stage-controller.js | 41 | ||||
-rwxr-xr-x | js/controllers/selection-controller.js | 12 |
7 files changed, 121 insertions, 36 deletions
diff --git a/js/controllers/color-controller.js b/js/controllers/color-controller.js index 53573baf..8e000b19 100755 --- a/js/controllers/color-controller.js +++ b/js/controllers/color-controller.js | |||
@@ -198,7 +198,6 @@ exports.ColorController = Montage.create(Component, { | |||
198 | handleChange: { | 198 | handleChange: { |
199 | enumerable: true, | 199 | enumerable: true, |
200 | value: function (e) { | 200 | value: function (e) { |
201 | |||
202 | // | 201 | // |
203 | var actionEvent, color, input = e._event.input, panelMode, mode = e._event.mode; | 202 | var actionEvent, color, input = e._event.input, panelMode, mode = e._event.mode; |
204 | if (this.colorView) { | 203 | if (this.colorView) { |
@@ -228,14 +227,14 @@ exports.ColorController = Montage.create(Component, { | |||
228 | // | 227 | // |
229 | this.fill = color; | 228 | this.fill = color; |
230 | // | 229 | // |
231 | if(e._event.wasSetByCode) return; | 230 | if(e._event.wasSetByCode && mode !== 'nocolor') return; |
232 | // | 231 | // |
233 | this.setColor(mode, color, true); | 232 | this.setColor(mode, color, true); |
234 | } else if (input === 'stroke') { | 233 | } else if (input === 'stroke') { |
235 | // | 234 | // |
236 | this.stroke = color; | 235 | this.stroke = color; |
237 | // | 236 | // |
238 | if(e._event.wasSetByCode) return; | 237 | if(e._event.wasSetByCode && mode !== 'nocolor') return; |
239 | 238 | ||
240 | this.setColor(mode, color, false); | 239 | this.setColor(mode, color, false); |
241 | } | 240 | } |
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 7d982a62..d5556fa8 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -64,22 +64,29 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
64 | 64 | ||
65 | this.eventManager.addEventListener("styleSheetDirty", this, false); | 65 | this.eventManager.addEventListener("styleSheetDirty", this, false); |
66 | 66 | ||
67 | this.eventManager.addEventListener("addComponentFirstDraw", this, false); | ||
67 | } | 68 | } |
68 | }, | 69 | }, |
69 | 70 | ||
70 | 71 | handleAddComponentFirstDraw: { | |
72 | value: function (e) { | ||
73 | //TODO: Add logic to reparse the document for dynamically added styles | ||
74 | console.log(e); | ||
75 | } | ||
76 | }, | ||
71 | 77 | ||
72 | 78 | ||
73 | 79 | ||
74 | 80 | ||
75 | 81 | ||
76 | //////////////////////////////////////////////////////////////////// | 82 | //////////////////////////////////////////////////////////////////// |
77 | // | 83 | // |
78 | handleWebRequest: { | 84 | handleWebRequest: { |
79 | value: function (request) { | 85 | value: function (request) { |
80 | //TODO: Check if frameId is proper | 86 | //TODO: Check if frameId is proper |
81 | if (this._hackRootFlag && request.parentFrameId !== -1) { | 87 | if (this._hackRootFlag && request.parentFrameId !== -1) { |
82 | //TODO: Optimize creating string | 88 | //TODO: Optimize creating string |
89 | //console.log(request); | ||
83 | //console.log(this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1], request.url); | 90 | //console.log(this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1], request.url); |
84 | //return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split('/')[request.url.split('/').length-1]}; | 91 | //return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split('/')[request.url.split('/').length-1]}; |
85 | return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split(chrome.extension.getURL('js/document/templates/montage-html/'))[1]}; | 92 | return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split(chrome.extension.getURL('js/document/templates/montage-html/'))[1]}; |
@@ -103,6 +110,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
103 | }, | 110 | }, |
104 | //////////////////////////////////////////////////////////////////// | 111 | //////////////////////////////////////////////////////////////////// |
105 | 112 | ||
113 | |||
106 | 114 | ||
107 | 115 | ||
108 | 116 | ||
diff --git a/js/controllers/elements/component-controller.js b/js/controllers/elements/component-controller.js index 83450d0f..260ee8a0 100755 --- a/js/controllers/elements/component-controller.js +++ b/js/controllers/elements/component-controller.js | |||
@@ -11,6 +11,8 @@ exports.ComponentController = Montage.create(ElementController, { | |||
11 | 11 | ||
12 | getProperty: { | 12 | getProperty: { |
13 | value: function(el, prop) { | 13 | value: function(el, prop) { |
14 | var component = el.controller || this.application.ninja.currentDocument.getComponentFromElement(el); | ||
15 | |||
14 | switch(prop) { | 16 | switch(prop) { |
15 | case "id": | 17 | case "id": |
16 | case "class": | 18 | case "class": |
@@ -19,18 +21,20 @@ exports.ComponentController = Montage.create(ElementController, { | |||
19 | case "width": | 21 | case "width": |
20 | case "height": | 22 | case "height": |
21 | if(el.nodeName === "IMG" && (prop === "width" || prop === "height")) { | 23 | if(el.nodeName === "IMG" && (prop === "width" || prop === "height")) { |
22 | return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; | 24 | return component[prop]; |
23 | } else { | 25 | } else { |
24 | return ElementController.getProperty(el, prop, true); | 26 | return ElementController.getProperty(el, prop, true); |
25 | } | 27 | } |
26 | default: | 28 | default: |
27 | return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; | 29 | return component[prop]; |
28 | } | 30 | } |
29 | } | 31 | } |
30 | }, | 32 | }, |
31 | 33 | ||
32 | setProperty: { | 34 | setProperty: { |
33 | value: function(el, p, value) { | 35 | value: function(el, p, value) { |
36 | var component = el.controller || this.application.ninja.currentDocument.getComponentFromElement(el); | ||
37 | |||
34 | switch(p) { | 38 | switch(p) { |
35 | case "id": | 39 | case "id": |
36 | case "class": | 40 | case "class": |
@@ -39,15 +43,14 @@ exports.ComponentController = Montage.create(ElementController, { | |||
39 | case "width": | 43 | case "width": |
40 | case "height": | 44 | case "height": |
41 | if(el.nodeName === "IMG" && (p === "width" || p === "height")) { | 45 | if(el.nodeName === "IMG" && (p === "width" || p === "height")) { |
42 | this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value; | 46 | component[p] = value; |
43 | } else { | 47 | } else { |
44 | ElementController.setProperty(el, p, value); | 48 | ElementController.setProperty(el, p, value); |
45 | } | 49 | } |
46 | break; | 50 | break; |
47 | default: | 51 | default: |
48 | if(p === "min" || p === "max") value = parseFloat(value); | 52 | if(p === "min" || p === "max") value = parseFloat(value); |
49 | 53 | component[p] = value; | |
50 | this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value; | ||
51 | break; | 54 | break; |
52 | 55 | ||
53 | } | 56 | } |
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index 70aba54e..b35251ad 100755 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js | |||
@@ -228,22 +228,6 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, | |||
228 | mat = this.transformStringToMat( xformStr ); | 228 | mat = this.transformStringToMat( xformStr ); |
229 | if (!mat) | 229 | if (!mat) |
230 | mat = Matrix.I(4); | 230 | mat = Matrix.I(4); |
231 | |||
232 | var zoom = this.application.ninja.elementMediator.getProperty(el, "zoom"); | ||
233 | if (zoom) | ||
234 | { | ||
235 | zoom = Number(zoom); | ||
236 | if (zoom != 1) | ||
237 | { | ||
238 | var zoomMat = Matrix.create( [ | ||
239 | [ zoom, 0, 0, 0], | ||
240 | [ 0, zoom, 0, 0], | ||
241 | [ 0, 0, zoom, 0], | ||
242 | [ 0, 0, 0, 1] | ||
243 | ] ); | ||
244 | glmat4.multiply( zoomMat, mat, mat ); | ||
245 | } | ||
246 | } | ||
247 | } | 231 | } |
248 | 232 | ||
249 | el.elementModel.props3D.matrix3d = mat; | 233 | el.elementModel.props3D.matrix3d = mat; |
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index 46e337b7..68a82762 100755 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js | |||
@@ -6,10 +6,9 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
6 | 6 | ||
7 | var Montage = require("montage/core/core").Montage, | 7 | var Montage = require("montage/core/core").Montage, |
8 | CanvasController = require("js/controllers/elements/canvas-controller").CanvasController, | 8 | CanvasController = require("js/controllers/elements/canvas-controller").CanvasController, |
9 | njModule = require("js/lib/NJUtils"); | 9 | njModule = require("js/lib/NJUtils"), |
10 | 10 | World = require("js/lib/drawing/world").World, | |
11 | var World = require("js/lib/drawing/world").World; | 11 | MaterialsModel = require("js/models/materials-model").MaterialsModel; |
12 | var MaterialsModel = require("js/models/materials-model").MaterialsModel; | ||
13 | 12 | ||
14 | exports.ShapesController = Montage.create(CanvasController, { | 13 | exports.ShapesController = Montage.create(CanvasController, { |
15 | 14 | ||
@@ -100,6 +99,26 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
100 | el.elementModel.shapeModel.GLWorld.render(); | 99 | el.elementModel.shapeModel.GLWorld.render(); |
101 | } | 100 | } |
102 | break; |