aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/3D/draw-utils.js
diff options
context:
space:
mode:
authorValerio Virgillito2012-02-02 15:12:03 -0800
committerValerio Virgillito2012-02-02 15:12:03 -0800
commit4c6ea2383650ae328ed1e69c5f9c7c6878c6f810 (patch)
tree1f4194554032bee6a87aadf15cb647398a98b437 /js/helper-classes/3D/draw-utils.js
parent7303d3a7c3913658bf33be5f99db85a30889cfd9 (diff)
parentd41dee0c552a30724a146965ae4272a268777fc5 (diff)
downloadninja-4c6ea2383650ae328ed1e69c5f9c7c6878c6f810.tar.gz
Merge pull request #12 from mqg734/ToolFixes
Merged pan and zoom tool and 3d stage orientation fixes. Also updated PI to support shapes properties.
Diffstat (limited to 'js/helper-classes/3D/draw-utils.js')
-rw-r--r--js/helper-classes/3D/draw-utils.js28
1 files changed, 27 insertions, 1 deletions
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 }
171 } 196 }
@@ -1064,7 +1089,8 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
1064 var resMat = glmat4.multiply( tMat, mat, [] ); 1089 var resMat = glmat4.multiply( tMat, mat, [] );
1065 var origin = [0,0,0,1]; 1090 var origin = [0,0,0,1];
1066 1091
1067 var arrowSize = 50; 1092 var zoomFactor = this.application.ninja.documentBar.zoomFactor/100.0;
1093 var arrowSize = 50 / zoomFactor;
1068 var xAxis = [arrowSize,0,0,1]; 1094 var xAxis = [arrowSize,0,0,1];
1069 //var rO = resMat.multiply(origin); 1095 //var rO = resMat.multiply(origin);
1070 var rO = glmat4.multiplyVec3( resMat, origin, []); 1096 var rO = glmat4.multiplyVec3( resMat, origin, []);