aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/3D
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-02-03 14:06:26 -0800
committerNivesh Rajbhandari2012-02-03 14:06:26 -0800
commit854a6d1be334782c8e232601e6d562a11296e55a (patch)
tree008f69b921f3a1de6df5871f20def6098452f2a6 /js/helper-classes/3D
parent91de8f585e93d1a959c7fe56775df371ce6f50d6 (diff)
downloadninja-854a6d1be334782c8e232601e6d562a11296e55a.tar.gz
Update grid and planes when elementChange event signifies the "matrix", "left", "top", "width" or "height" properties have changed.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/helper-classes/3D')
-rw-r--r--js/helper-classes/3D/draw-utils.js34
1 files changed, 33 insertions, 1 deletions
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js
index fd96af4d..fe617548 100644
--- a/js/helper-classes/3D/draw-utils.js
+++ b/js/helper-classes/3D/draw-utils.js
@@ -71,6 +71,9 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
71 71
72 _selectionCtr : {value: null, writable: true }, 72 _selectionCtr : {value: null, writable: true },
73 73
74 // Properties that require element planes to be updated
75 _updatePlaneProps : {value: ["matrix", "left", "top", "width", "height"], writable: false },
76
74 /////////////////////////////////////////////////////////////////////// 77 ///////////////////////////////////////////////////////////////////////
75 // Property accessors 78 // Property accessors
76 /////////////////////////////////////////////////////////////////////// 79 ///////////////////////////////////////////////////////////////////////
@@ -124,11 +127,38 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
124 } 127 }
125 }, 128 },
126 129
130 _shouldUpdatePlanes: {
131 value: function(props) {
132 if(!props)
133 {
134 return false;
135 }
136 else if (typeof props === "string")
137 {
138 return (this._updatePlaneProps.indexOf(props) !== -1);
139 }
140
141 for (var p in props)
142 {
143 if(this._updatePlaneProps.indexOf(p) !== -1)
144 {
145 return true;
146 }
147 }
148
149 return false;
150 }
151 },
127 152
153 // TODO - Check why handleElementChange is being fired before handleAddElement
128 handleElementChange: { 154 handleElementChange: {
129 value: function(event) { 155 value: function(event) {
156 if(!event.detail || !event.detail.data)
157 {
158 return;
159 }
130 var els = event.detail.data.els; 160 var els = event.detail.data.els;
131 if(els) 161 if(els && this._shouldUpdatePlanes(event.detail.data.prop))
132 { 162 {
133 var len = els.length, 163 var len = els.length,
134 i = 0, 164 i = 0,
@@ -141,7 +171,9 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
141 el.elementModel.props3D.elementPlane.init(); 171 el.elementModel.props3D.elementPlane.init();
142 } 172 }
143 173
174 this.application.ninja.stage.layout.draw();
144 this.drawWorkingPlane(); 175 this.drawWorkingPlane();
176 this.draw3DCompass();
145 } 177 }
146 } 178 }
147 }, 179 },