aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-01-30 13:25:15 -0800
committerNivesh Rajbhandari2012-01-30 13:25:15 -0800
commit51b4e61d6c6df5e88e9a5dfcdfd7944e2a3f64e7 (patch)
tree8860b6b919eb280ced000845da8a129a311114b3 /js
parent7e0c709b4f0557d0f8fd6da8a47dc26172513cc8 (diff)
downloadninja-51b4e61d6c6df5e88e9a5dfcdfd7944e2a3f64e7.tar.gz
Syncing stage view when rotating stage.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js')
-rw-r--r--js/helper-classes/3D/draw-utils.js25
-rw-r--r--js/models/properties-3d.js2
-rw-r--r--js/stage/layout.js14
-rw-r--r--js/stage/stage.reel/stage.js2
-rw-r--r--js/tools/SelectionTool.js1
5 files changed, 39 insertions, 5 deletions
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js
index 3fd6e8fc..c26a5cd1 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 }
171 } 196 }
diff --git a/js/models/properties-3d.js b/js/models/properties-3d.js
index 6d65bc91..3c809f06 100644
--- a/js/models/properties-3d.js
+++ b/js/models/properties-3d.js
@@ -36,6 +36,8 @@ exports.Properties3D = Montage.create(Component, {
36 perspectiveDist : { value : 1400, enumerable: true}, 36 perspectiveDist : { value : 1400, enumerable: true},
37 perspectiveMode : { value : null, enumerable: true}, 37 perspectiveMode : { value : null, enumerable: true},
38 38
39 elementPlane : { value : null, enumerable: true},
40
39 init : { 41 init : {
40 value : function(elt) { 42 value : function(elt) {
41 43
diff --git a/js/stage/layout.js b/js/stage/layout.js
index 625c09ad..89fa44f3 100644
--- a/js/stage/layout.js
+++ b/js/stage/layout.js
@@ -112,6 +112,7 @@ exports.Layout = Montage.create(Component, {
112 } 112 }
113 113
114 this.draw(); // Not a reel yet :) 114 this.draw(); // Not a reel yet :)
115 this.draw3DInfo(false);
115 116
116 117
117 } 118 }
@@ -128,9 +129,16 @@ exports.Layout = Montage.create(Component, {
128 }, 129 },
129 130
130 draw3DInfo: { 131 draw3DInfo: {
131 value: function() { 132 value: function(updatePlanes) {
132 drawUtils.updatePlanes(); 133 if(updatePlanes)
133 if(this.stage.appModel.show3dGrid) drawUtils.drawWorkingPlane(); 134 {
135 drawUtils.updatePlanes();
136 }
137 if(this.stage.appModel.show3dGrid)
138 {
139 this.application.ninja.stage.stageDeps.snapManager.updateWorkingPlaneFromView();
140 drawUtils.drawWorkingPlane();
141 }
134 drawUtils.draw3DCompass(); 142 drawUtils.draw3DCompass();
135 } 143 }
136 }, 144 },
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js
index 3e0b852e..31d0f8c2 100644
--- a/js/stage/stage.reel/stage.js
+++ b/js/stage/stage.reel/stage.js
@@ -175,7 +175,7 @@ exports.Stage = Montage.create(Component, {
175 } 175 }
176 else if(this.updatedStage) { 176 else if(this.updatedStage) {
177 this.layout.draw(); 177 this.layout.draw();
178 this.layout.draw3DInfo(); 178 this.layout.draw3DInfo(true);
179 } 179 }
180 } 180 }
181 }, 181 },
diff --git a/js/tools/SelectionTool.js b/js/tools/SelectionTool.js
index 5f2a959f..862b2e88 100644
--- a/js/tools/SelectionTool.js
+++ b/js/tools/SelectionTool.js
@@ -180,7 +180,6 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, {
180 this._handleMode = null; 180 this._handleMode = null;
181 this._delta = null; 181 this._delta = null;
182 this.DrawHandles(); 182 this.DrawHandles();
183 console.log( "move: (" + dx + ", " + dy + ")" );
184 } 183 }
185 184
186 this.endDraw(event); 185 this.endDraw(event);