aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements
diff options
context:
space:
mode:
Diffstat (limited to 'js/controllers/elements')
-rwxr-xr-xjs/controllers/elements/element-controller.js59
-rwxr-xr-xjs/controllers/elements/shapes-controller.js4
-rwxr-xr-xjs/controllers/elements/stage-controller.js7
3 files changed, 12 insertions, 58 deletions
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js
index b35251ad..9cba6d94 100755
--- a/js/controllers/elements/element-controller.js
+++ b/js/controllers/elements/element-controller.js
@@ -223,11 +223,10 @@ var ElementController = exports.ElementController = Montage.create(NJComponent,
223 223
224 if (el) 224 if (el)
225 { 225 {
226 var xformStr = this.application.ninja.elementMediator.getProperty(el, "-webkit-transform"); 226 mat = this.application.ninja.stylesController.getMatrixFromElement(el, false);
227 if (xformStr) 227 if (!mat) {
228 mat = this.transformStringToMat( xformStr );
229 if (!mat)
230 mat = Matrix.I(4); 228 mat = Matrix.I(4);
229 }
231 } 230 }
232 231
233 el.elementModel.props3D.matrix3d = mat; 232 el.elementModel.props3D.matrix3d = mat;
@@ -244,23 +243,9 @@ var ElementController = exports.ElementController = Montage.create(NJComponent,
244 } 243 }
245 else 244 else
246 { 245 {
247 var dist = 1400; 246 var dist = this.application.ninja.stylesController.getPerspectiveDistFromElement(el, false);
248 247 if(dist == null) {
249 var str = this.getProperty(el, "-webkit-transform"); 248 dist = 1400;
250 if (str)
251 {
252 var index1 = str.indexOf( "perspective(");
253 if (index1 >= 0)
254 {
255 index1 += 12; // do not include 'perspective('
256 var index2 = str.indexOf( ")", index1 );
257 if (index2 >= 0)
258 {
259 var substr = str.substr( index1, (index2-index1));
260 if (substr && (substr.length > 0))
261 dist = MathUtils.styleToNumber( substr );
262 }
263 }
264 } 249 }
265 250
266 el.elementModel.props3D.perspectiveDist = dist; 251 el.elementModel.props3D.perspectiveDist = dist;
@@ -303,36 +288,6 @@ var ElementController = exports.ElementController = Montage.create(NJComponent,
303 elt.elementModel.props3D.z3D = ~~(elt3DInfo.translation[2]); 288 elt.elementModel.props3D.z3D = ~~(elt3DInfo.translation[2]);
304 } 289 }
305 } 290 }
306 },
307
308 transformStringToMat: {
309 value: function( str ) {
310 var rtnMat;
311
312 var index1 = str.indexOf( "matrix3d(");
313 if (index1 >= 0)
314 {
315 index1 += 9; // do not include 'matrix3d('
316 var index2 = str.indexOf( ")", index1 );
317 if (index2 >= 0)
318 {
319 var substr = str.substr( index1, (index2-index1));
320 if (substr && (substr.length > 0))
321 {
322 var numArray = substr.split(',');
323 var nNums = numArray.length;
324 if (nNums == 16)
325 {
326 // gl-matrix wants row order
327 rtnMat = numArray;
328 for (var i=0; i<16; i++)
329 rtnMat[i] = Number( rtnMat[i] );
330 }
331 }
332 }
333 }
334
335 return rtnMat;
336 }
337 } 291 }
292
338}); \ No newline at end of file 293}); \ No newline at end of file
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index b3ac9ddb..9b0159d4 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -495,7 +495,7 @@ exports.ShapesController = Montage.create(CanvasController, {
495 world = new World(el, true); 495 world = new World(el, true);
496 el.elementModel.shapeModel.GLWorld = world; 496 el.elementModel.shapeModel.GLWorld = world;
497 el.elementModel.shapeModel.useWebGl = true; 497 el.elementModel.shapeModel.useWebGl = true;
498 world.import(worldData); 498 world.import(worldData, true);
499 el.elementModel.shapeModel.GLGeomObj = world.getGeomRoot(); 499 el.elementModel.shapeModel.GLGeomObj = world.getGeomRoot();
500 500
501 sm = Object.create(MaterialsModel.getMaterial("FlatMaterial")); 501 sm = Object.create(MaterialsModel.getMaterial("FlatMaterial"));
@@ -531,7 +531,7 @@ exports.ShapesController = Montage.create(CanvasController, {
531 world = new World(el, false); 531 world = new World(el, false);
532 el.elementModel.shapeModel.GLWorld = world; 532 el.elementModel.shapeModel.GLWorld = world;
533 el.elementModel.shapeModel.useWebGl = false; 533 el.elementModel.shapeModel.useWebGl = false;
534 world.import(worldData); 534 world.import(worldData, true);
535 el.elementModel.shapeModel.GLGeomObj = world.getGeomRoot(); 535 el.elementModel.shapeModel.GLGeomObj = world.getGeomRoot();
536 el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(null); 536 el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(null);
537 el.elementModel.shapeModel.strokeMaterial = null; 537 el.elementModel.shapeModel.strokeMaterial = null;
diff --git a/js/controllers/elements/stage-controller.js b/js/controllers/elements/stage-controller.js
index 97ea3aa5..2734e226 100755
--- a/js/controllers/elements/stage-controller.js
+++ b/js/controllers/elements/stage-controller.js
@@ -143,11 +143,10 @@ exports.StageController = Montage.create(ElementController, {
143 143
144 if (el) 144 if (el)
145 { 145 {
146 var xformStr = this.application.ninja.elementMediator.getProperty(el, "-webkit-transform"); 146 mat = this.application.ninja.stylesController.getMatrixFromElement(el, true);
147 if (xformStr) 147 if (!mat) {
148 mat = this.transformStringToMat( xformStr );
149 if (!mat)
150 mat = Matrix.I(4); 148 mat = Matrix.I(4);
149 }
151 150
152 var zoom = this.application.ninja.elementMediator.getProperty(el, "zoom"); 151 var zoom = this.application.ninja.elementMediator.getProperty(el, "zoom");
153 if (zoom) 152 if (zoom)