From e28eb9158a50d7e6d97dbc68066e591ac600c241 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 5 Jun 2012 21:40:44 -0700 Subject: removing all model creators. The elementModel is now a getter that will create a new model when needed. Signed-off-by: Valerio Virgillito --- js/controllers/elements/body-controller.js | 4 ++-- js/controllers/elements/element-controller.js | 8 ++++---- js/controllers/elements/shapes-controller.js | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/elements/body-controller.js b/js/controllers/elements/body-controller.js index 7a3a66f5..9c427c62 100755 --- a/js/controllers/elements/body-controller.js +++ b/js/controllers/elements/body-controller.js @@ -71,7 +71,7 @@ exports.BodyController = Montage.create(ElementController, { getPerspectiveDist: { value: function(el) { - if(el.elementModel && el.elementModel.props3D && el.elementModel.props3D.perspectiveDist) { + if(el.elementModel.props3D && el.elementModel.props3D.perspectiveDist) { return el.elementModel.props3D.perspectiveDist; } else { var dist = this.application.ninja.stylesController.getPerspectiveDistFromElement(el, true); @@ -83,7 +83,7 @@ exports.BodyController = Montage.create(ElementController, { getMatrix: { value: function(el) { - if(el.elementModel && el.elementModel.props3D && el.elementModel.props3D.matrix3d) + if(el.elementModel.props3D && el.elementModel.props3D.matrix3d) { return el.elementModel.props3D.matrix3d.slice(0); } diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index 01e132d7..0223a6b5 100755 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js @@ -36,7 +36,7 @@ exports.ElementController = Montage.create(Component, { // Remove the element from the DOM and clear the GLWord. removeElement: { value: function(el) { - if(el.elementModel && el.elementModel.shapeModel && el.elementModel.shapeModel.GLWorld) { + if(el.elementModel.shapeModel && el.elementModel.shapeModel.GLWorld) { el.elementModel.shapeModel.GLWorld.clearTree(); } el.parentNode.removeChild(el); @@ -229,7 +229,7 @@ exports.ElementController = Montage.create(Component, { // Routines to get/set 3D properties get3DProperty: { value: function(el, prop) { - if(el.elementModel && el.elementModel.props3D) { + if(el.elementModel.props3D) { return el.elementModel.props3D[prop]; } } @@ -237,7 +237,7 @@ exports.ElementController = Montage.create(Component, { getMatrix: { value: function(el) { - if(el.elementModel && el.elementModel.props3D && el.elementModel.props3D.matrix3d) { + if(el.elementModel.props3D && el.elementModel.props3D.matrix3d) { return el.elementModel.props3D.matrix3d.slice(0); } else { var mat; @@ -257,7 +257,7 @@ exports.ElementController = Montage.create(Component, { getPerspectiveDist: { value: function(el) { - if(el.elementModel && el.elementModel.props3D && el.elementModel.props3D.perspectiveDist) { + if(el.elementModel.props3D && el.elementModel.props3D.perspectiveDist) { return el.elementModel.props3D.perspectiveDist; } else { var dist = this.application.ninja.stylesController.getPerspectiveDistFromElement(el, false); diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index 626dedb6..ae345489 100755 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js @@ -133,7 +133,7 @@ exports.ShapesController = Montage.create(CanvasController, { canvas.setAttribute("data-RDGE-id", njModule.NJUtils.generateRandom()); canvas.width = el.width; canvas.height = el.height; - canvas.elementModel = el.elementModel; + canvas._model = el.elementModel; this.toggleWebGlMode(canvas, value); this.application.ninja.elementMediator.replaceElement(canvas, el); break; -- cgit v1.2.3