diff options
author | Pushkar Joshi | 2012-02-02 11:28:45 -0800 |
---|---|---|
committer | Pushkar Joshi | 2012-02-02 11:28:45 -0800 |
commit | acc500d1f1c76f4e7c93ae1cfea8d925ca95e7b9 (patch) | |
tree | 877f8ca734228c11050b037ce82fc0d1e1303193 /js/helper-classes/3D | |
parent | 4d4de64472603426a73b26cc98ba8206190949b8 (diff) | |
parent | 4222db97e353fb65fab787ba5927d16d9fa4e1f7 (diff) | |
download | ninja-acc500d1f1c76f4e7c93ae1cfea8d925ca95e7b9.tar.gz |
Merge branch 'working' of c:/Code/github/emueller/ninja-internal/ into pentool
Diffstat (limited to 'js/helper-classes/3D')
-rw-r--r-- | js/helper-classes/3D/draw-utils.js | 28 | ||||
-rw-r--r-- | js/helper-classes/3D/snap-manager.js | 11 |
2 files changed, 37 insertions, 2 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, []); |
diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index 3ed96082..8819f637 100644 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js | |||
@@ -1780,7 +1780,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
1780 | var mergedSnap = this.mergeHitRecords( hitRecs ); | 1780 | var mergedSnap = this.mergeHitRecords( hitRecs ); |
1781 | if (mergedSnap) | 1781 | if (mergedSnap) |
1782 | { | 1782 | { |
1783 | while (hitRecs.length > 0) hitRecs.pop(); | 1783 | while (hitRecs.length > 0) hitRecs.pop(); |
1784 | hitRecs.push( mergedSnap ); | 1784 | hitRecs.push( mergedSnap ); |
1785 | //console.log( "merged snaps" ); | 1785 | //console.log( "merged snaps" ); |
1786 | } | 1786 | } |
@@ -1836,6 +1836,9 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
1836 | hSnap.setLocalPoint( localPt ); | 1836 | hSnap.setLocalPoint( localPt ); |
1837 | hSnap.setScreenPoint( scrPt ); | 1837 | hSnap.setScreenPoint( scrPt ); |
1838 | hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED ); | 1838 | hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED ); |
1839 | hSnap.setElement( stage ); | ||
1840 | hSnap.setPlane( [0,0,1,0] ); | ||
1841 | hSnap.setPlaneMatrix( Matrix.I(4) ); | ||
1839 | if (vSnap.hasAssociatedScreenPoint() ) | 1842 | if (vSnap.hasAssociatedScreenPoint() ) |
1840 | hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() ); | 1843 | hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() ); |
1841 | if (vSnap.hasAssociatedScreenPoint2() ) | 1844 | if (vSnap.hasAssociatedScreenPoint2() ) |
@@ -1882,6 +1885,9 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
1882 | hSnap.setLocalPoint( localPt ); | 1885 | hSnap.setLocalPoint( localPt ); |
1883 | hSnap.setScreenPoint( scrPt ); | 1886 | hSnap.setScreenPoint( scrPt ); |
1884 | hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED ); | 1887 | hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED ); |
1888 | hSnap.setElement( stage ); | ||
1889 | hSnap.setPlane( [0,0,1,0] ); | ||
1890 | hSnap.setPlaneMatrix( Matrix.I(4) ); | ||
1885 | if (vSnap.hasAssociatedScreenPoint() ) | 1891 | if (vSnap.hasAssociatedScreenPoint() ) |
1886 | hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() ); | 1892 | hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() ); |
1887 | if (vSnap.hasAssociatedScreenPoint2() ) | 1893 | if (vSnap.hasAssociatedScreenPoint2() ) |
@@ -1934,6 +1940,9 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
1934 | hSnap.setLocalPoint( localPt ); | 1940 | hSnap.setLocalPoint( localPt ); |
1935 | hSnap.setScreenPoint( scrPt ); | 1941 | hSnap.setScreenPoint( scrPt ); |
1936 | hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED ); | 1942 | hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED ); |
1943 | hSnap.setElement( stage ); | ||
1944 | hSnap.setPlane( [0,0,1,0] ); | ||
1945 | hSnap.setPlaneMatrix( Matrix.I(4) ); | ||
1937 | if (vSnap.hasAssociatedScreenPoint() ) | 1946 | if (vSnap.hasAssociatedScreenPoint() ) |
1938 | hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() ); | 1947 | hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() ); |
1939 | if (vSnap.hasAssociatedScreenPoint2() ) | 1948 | if (vSnap.hasAssociatedScreenPoint2() ) |