diff options
Diffstat (limited to 'js')
44 files changed, 835 insertions, 469 deletions
diff --git a/js/controllers/elements/canvas-controller.js b/js/controllers/elements/canvas-controller.js index 21de9879..b5df3911 100644 --- a/js/controllers/elements/canvas-controller.js +++ b/js/controllers/elements/canvas-controller.js | |||
@@ -34,12 +34,12 @@ exports.CanvasController = Montage.create(ElementController, { | |||
34 | } | 34 | } |
35 | } | 35 | } |
36 | }, | 36 | }, |
37 | 37 | ||
38 | setProperties: { | 38 | setProperties: { |
39 | value: function(el, props, index) { | 39 | value: function(el, props, index) { |
40 | for(var p in props) { | 40 | for(var p in props) { |
41 | el.elementModel.controller.setProperty(el, p, props[p][index]); | 41 | el.elementModel.controller.setProperty(el, p, props[p][index]); |
42 | } | 42 | } |
43 | } | 43 | } |
44 | } | 44 | } |
45 | }); \ No newline at end of file | 45 | }); \ No newline at end of file |
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index f254220c..f2b54014 100644 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js | |||
@@ -127,36 +127,35 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, | |||
127 | } | 127 | } |
128 | else | 128 | else |
129 | { | 129 | { |
130 | // TODO - for now, just return the identity matrix | 130 | var mat; |
131 | return Matrix.I(4); | 131 | |
132 | // var mat; | 132 | if (el) |
133 | // | 133 | { |
134 | // if (elt) | 134 | var xformStr = this.application.ninja.elementMediator.getProperty(el, "-webkit-transform"); |
135 | // { | 135 | if (xformStr) |
136 | // var xformStr = ElementsMediator.getProperty(elt, "-webkit-transform"); | 136 | mat = this.transformStringToMat( xformStr ); |
137 | // if (xformStr) | 137 | if (!mat) |
138 | // mat = this.transformStringToMat( xformStr ); | 138 | mat = Matrix.I(4); |
139 | // if (!mat) | 139 | |
140 | // mat = Matrix.I(4); | 140 | var zoom = this.application.ninja.elementMediator.getProperty(el, "zoom"); |
141 | // | 141 | if (zoom) |
142 | // if (elt.style && elt.style.zoom) | 142 | { |
143 | // { | 143 | zoom = Number(zoom); |
144 | // var zoom = Number(elt.style.zoom); | 144 | if (zoom != 1) |
145 | // if (zoom != 1) | 145 | { |
146 | // { | 146 | var zoomMat = Matrix.create( [ |
147 | // var zoomMat = Matrix.create( [ | 147 | [ zoom, 0, 0, 0], |
148 | // [ zoom, 0, 0, 0], | 148 | [ 0, zoom, 0, 0], |
149 | // [ 0, zoom, 0, 0], | 149 | [ 0, 0, zoom, 0], |
150 | // [ 0, 0, zoom, 0], | 150 | [ 0, 0, 0, 1] |
151 | // [ 0, 0, 0, 1] | 151 | ] ); |
152 | // ] ); | 152 | glmat4.multiply( zoomMat, mat, mat ); |
153 | // glmat4.multiply( zoomMat, mat, mat ); | 153 | } |
154 | // } | 154 | } |
155 | // } | 155 | } |
156 | // } | 156 | |
157 | // | 157 | el.elementModel.props3D.matrix3d = mat; |
158 | // elt.elementModel.props3D.matrix3d = mat; | 158 | return mat; |
159 | // return mat; | ||
160 | } | 159 | } |
161 | } | 160 | } |
162 | }, | 161 | }, |
@@ -207,7 +206,7 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, | |||
207 | el.elementModel.props3D.matrix3d = mat; | 206 | el.elementModel.props3D.matrix3d = mat; |
208 | el.elementModel.props3D.perspectiveDist = dist; | 207 | el.elementModel.props3D.perspectiveDist = dist; |
209 | 208 | ||
210 | // if(update3DModel) | 209 | if(update3DModel) |
211 | { | 210 | { |
212 | this._update3DProperties(el, mat, dist); | 211 | this._update3DProperties(el, mat, dist); |
213 | } | 212 | } |
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index 3fd6e8fc..fd96af4d 100644 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js | |||
@@ -107,6 +107,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
107 | 107 | ||
108 | this.eventManager.addEventListener("elementAdded", this, false); | 108 | this.eventManager.addEventListener("elementAdded", this, false); |
109 | this.eventManager.addEventListener("elementDeleted", this, false); | 109 | this.eventManager.addEventListener("elementDeleted", this, false); |
110 | this.eventManager.addEventListener("elementChange", this, false); | ||
110 | } | 111 | } |
111 | }, | 112 | }, |
112 | 113 | ||
@@ -124,6 +125,27 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
124 | }, | 125 | }, |
125 | 126 | ||
126 | 127 | ||
128 | handleElementChange: { | ||
129 | value: function(event) { | ||
130 | var els = event.detail.data.els; | ||
131 | if(els) | ||
132 | { | ||
133 | var len = els.length, | ||
134 | i = 0, | ||
135 | item, | ||
136 | el; | ||
137 | |||
138 | for(i=0; i < len; i++) { | ||
139 | item = els[i]; | ||
140 | el = item._element || item; | ||
141 | el.elementModel.props3D.elementPlane.init(); | ||
142 | } | ||
143 | |||
144 | this.drawWorkingPlane(); | ||
145 | } | ||
146 | } | ||
147 | }, | ||
148 | |||
127 | /////////////////////////////////////////////////////////////////////// | 149 | /////////////////////////////////////////////////////////////////////// |
128 | // Methods | 150 | // Methods |
129 | /////////////////////////////////////////////////////////////////////// | 151 | /////////////////////////////////////////////////////////////////////// |
@@ -150,6 +172,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
150 | plane.setElement( elt ); | 172 | plane.setElement( elt ); |
151 | plane.init(); | 173 | plane.init(); |
152 | this._planesArray.push( plane ); | 174 | this._planesArray.push( plane ); |
175 | elt.elementModel.props3D.elementPlane = plane; | ||
153 | } | 176 | } |
154 | }, | 177 | }, |
155 | 178 | ||
@@ -166,6 +189,8 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
166 | 189 | ||
167 | // Then remove the element | 190 | // Then remove the element |
168 | this._eltArray.splice(i, 1); | 191 | this._eltArray.splice(i, 1); |
192 | |||
193 | // TODO - May need to delete props3D and elementPlane as well | ||
169 | return; | 194 | return; |
170 | } | 195 | } |