diff options
author | Jose Antonio Marquez | 2012-02-08 13:14:29 -0800 |
---|---|---|
committer | Jose Antonio Marquez | 2012-02-08 13:14:29 -0800 |
commit | 9b45b897949bf934c8bf2c90ee2ff78f8713cb12 (patch) | |
tree | e7c276a3934c823cab894f46ee7dc5d3eda9ca83 /js/helper-classes | |
parent | aa01c1210f3a4d9fd55a771b9de2c58ee3fa4bb6 (diff) | |
parent | 10cdeb52403f16d5d4be43a516e8cdfbc866a2a2 (diff) | |
download | ninja-9b45b897949bf934c8bf2c90ee2ff78f8713cb12.tar.gz |
Merge branch 'refs/heads/NinjaInternal' into Color
Conflicts:
js/controllers/elements/shapes-controller.js
js/data/pi/pi-data.js
js/panels/properties/content.reel/content.js
Diffstat (limited to 'js/helper-classes')
-rw-r--r-- | js/helper-classes/3D/draw-utils.js | 47 | ||||
-rw-r--r-- | js/helper-classes/3D/snap-manager.js | 15 | ||||
-rw-r--r-- | js/helper-classes/RDGE/GLCircle.js | 79 | ||||
-rw-r--r-- | js/helper-classes/RDGE/GLGeomObj.js | 51 | ||||
-rw-r--r-- | js/helper-classes/RDGE/GLLine.js | 27 | ||||
-rw-r--r-- | js/helper-classes/RDGE/GLRectangle.js | 65 | ||||
-rw-r--r-- | js/helper-classes/RDGE/GLWorld.js | 2 | ||||
-rw-r--r-- | js/helper-classes/RDGE/MaterialsLibrary.js | 2 |
8 files changed, 126 insertions, 162 deletions
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index fd96af4d..c07391db 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 | /////////////////////////////////////////////////////////////////////// |
@@ -107,6 +110,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
107 | 110 | ||
108 | this.eventManager.addEventListener("elementAdded", this, false); | 111 | this.eventManager.addEventListener("elementAdded", this, false); |
109 | this.eventManager.addEventListener("elementDeleted", this, false); | 112 | this.eventManager.addEventListener("elementDeleted", this, false); |
113 | this.eventManager.addEventListener("deleteSelection", this, false); | ||
110 | this.eventManager.addEventListener("elementChange", this, false); | 114 | this.eventManager.addEventListener("elementChange", this, false); |
111 | } | 115 | } |
112 | }, | 116 | }, |
@@ -124,11 +128,44 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
124 | } | 128 | } |
125 | }, | 129 | }, |
126 | 130 | ||
131 | handleDeleteSelection: { | ||
132 | value: function(event) { | ||
133 | this.drawWorkingPlane(); | ||
134 | } | ||
135 | }, | ||
136 | |||
137 | _shouldUpdatePlanes: { | ||
138 | value: function(props) { | ||
139 | if(!props) | ||
140 | { | ||
141 | return false; | ||
142 | } | ||
143 | else if (typeof props === "string") | ||
144 | { | ||
145 | return (this._updatePlaneProps.indexOf(props) !== -1); | ||
146 | } | ||
147 | |||
148 | for (var p in props) | ||
149 | { | ||
150 | if(this._updatePlaneProps.indexOf(p) !== -1) | ||
151 | { | ||
152 | return true; | ||
153 | } | ||
154 | } | ||
155 | |||
156 | return false; | ||
157 | } | ||
158 | }, | ||
127 | 159 | ||
160 | // TODO - Check why handleElementChange is being fired before handleAddElement | ||
128 | handleElementChange: { | 161 | handleElementChange: { |
129 | value: function(event) { | 162 | value: function(event) { |
163 | if(!event.detail || !event.detail.data) | ||
164 | { | ||
165 | return; | ||
166 | } | ||
130 | var els = event.detail.data.els; | 167 | var els = event.detail.data.els; |
131 | if(els) | 168 | if(els && this._shouldUpdatePlanes(event.detail.data.prop)) |
132 | { | 169 | { |
133 | var len = els.length, | 170 | var len = els.length, |
134 | i = 0, | 171 | i = 0, |
@@ -138,10 +175,15 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
138 | for(i=0; i < len; i++) { | 175 | for(i=0; i < len; i++) { |
139 | item = els[i]; | 176 | item = els[i]; |
140 | el = item._element || item; | 177 | el = item._element || item; |
141 | el.elementModel.props3D.elementPlane.init(); | 178 | if(el.elementModel.props3D.elementPlane) |
179 | { | ||
180 | el.elementModel.props3D.elementPlane.init(); | ||
181 | } | ||
142 | } | 182 | } |
143 | 183 | ||
184 | this.application.ninja.stage.layout.draw(); | ||
144 | this.drawWorkingPlane(); | 185 | this.drawWorkingPlane(); |
186 | this.draw3DCompass(); | ||
145 | } | 187 | } |
146 | } | 188 | } |
147 | }, | 189 | }, |
@@ -1065,7 +1107,6 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
1065 | var tmpCanvas = this.application.ninja.stage.canvas; | 1107 | var tmpCanvas = this.application.ninja.stage.canvas; |
1066 | var tmpStage = this.application.ninja.currentDocument.documentRoot; | 1108 | var tmpStage = this.application.ninja.currentDocument.documentRoot; |
1067 | this.viewUtils.pushViewportObj( tmpCanvas ); | 1109 | this.viewUtils.pushViewportObj( tmpCanvas ); |
1068 | var tmpStage = this.application.ninja.currentDocument.documentRoot; | ||
1069 | 1110 | ||
1070 | // save the source space object and set to the target object | 1111 | // save the source space object and set to the target object |
1071 | var saveSource = this._sourceSpaceElt; | 1112 | var saveSource = this._sourceSpaceElt; |
diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index 8819f637..3af7d8cf 100644 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js | |||
@@ -9,14 +9,13 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
9 | // Class to do hit testing of objects in the html page | 9 | // Class to do hit testing of objects in the html page |
10 | /////////////////////////////////////////////////////////////////////// | 10 | /////////////////////////////////////////////////////////////////////// |
11 | var Montage = require("montage/core/core").Montage, | 11 | var Montage = require("montage/core/core").Montage, |
12 | Component = require("montage/ui/component").Component; | 12 | Component = require("montage/ui/component").Component, |
13 | 13 | viewUtils = require("js/helper-classes/3D/view-utils").ViewUtils, | |
14 | var viewUtils = require("js/helper-classes/3D/view-utils").ViewUtils; | 14 | vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils, |
15 | var vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils; | 15 | drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils, |
16 | var drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils; | 16 | HitRecord = require("js/helper-classes/3D/hit-record").HitRecord, |
17 | var HitRecord = require("js/helper-classes/3D/hit-record").HitRecord; | 17 | Snap2DRecord = require("js/helper-classes/3D/snap-2d-record").Snap2DRecord, |
18 | var Snap2DRecord = require("js/helper-classes/3D/snap-2d-record").Snap2DRecord; | 18 | NJUtils = require("js/lib/NJUtils").NJUtils; |
19 | var NJUtils = require("js/lib/NJUtils").NJUtils; | ||
20 | 19 | ||
21 | var SnapManager = exports.SnapManager = Montage.create(Component, { | 20 | var SnapManager = exports.SnapManager = Montage.create(Component, { |
22 | /////////////////////////////////////////////////////////////////////// | 21 | /////////////////////////////////////////////////////////////////////// |
diff --git a/js/helper-classes/RDGE/GLCircle.js b/js/helper-classes/RDGE/GLCircle.js index fc2e6460..e6bcba89 100644 --- a/js/helper-classes/RDGE/GLCircle.js +++ b/js/helper-classes/RDGE/GLCircle.js | |||
@@ -33,14 +33,6 @@ function GLCircle() | |||
33 | 33 | ||
34 | this._ovalHeight = this._ovalHeight = 2.0*this.radius; | 34 | this._ovalHeight = this._ovalHeight = 2.0*this.radius; |
35 | 35 | ||
36 | // stroke and fill colors | ||
37 | this._strokeColor = [0.4, 0.4, 0.4, 1.0]; | ||
38 | this._fillColor = [0.0, 0.6, 0.0, 1.0]; | ||
39 | |||
40 | // stroke and fill materials | ||
41 | this._fillMaterial; | ||
42 | this._strokeMaterial; | ||
43 | |||
44 | this._strokeStyle = "Solid"; | 36 | this._strokeStyle = "Solid"; |
45 | 37 | ||
46 | this._aspectRatio = 1.0; | 38 | this._aspectRatio = 1.0; |
@@ -189,19 +181,19 @@ function GLCircle() | |||
189 | var reverseRotMat = Matrix.RotationZ( -angle ); | 181 | var reverseRotMat = Matrix.RotationZ( -angle ); |
190 | 182 | ||
191 | // calculate matrices to scale the circle and stroke to fit the bounds of the ellipse | 183 | // calculate matrices to scale the circle and stroke to fit the bounds of the ellipse |
192 | strokeScaleMat = Matrix.I(4); | 184 | var strokeScaleMat = Matrix.I(4); |
193 | strokeScaleMat[0] = xRad; | 185 | strokeScaleMat[0] = xRad; |
194 | strokeScaleMat[5] = yRad; | 186 | strokeScaleMat[5] = yRad; |
195 | 187 | ||
196 | fillScaleMat = Matrix.I(4); | 188 | var fillScaleMat = Matrix.I(4); |
197 | fillScaleMat[0] = xRad - xStroke; | 189 | fillScaleMat[0] = xRad - xStroke; |
198 | fillScaleMat[5] = yRad - yStroke; | 190 | fillScaleMat[5] = yRad - yStroke; |
199 | 191 | ||
200 | innerRadiusScaleMat = Matrix.I(4); | 192 | var innerRadiusScaleMat = Matrix.I(4); |
201 | innerRadiusScaleMat[0] = xInnRad; | 193 | innerRadiusScaleMat[0] = xInnRad; |
202 | innerRadiusScaleMat[5] = yInnRad; | 194 | innerRadiusScaleMat[5] = yInnRad; |
203 | 195 | ||
204 | innerStrokeScaleMat = Matrix.I(4); | 196 | var innerStrokeScaleMat = Matrix.I(4); |
205 | innerStrokeScaleMat[0] = xInnRad - xStroke; | 197 | innerStrokeScaleMat[0] = xInnRad - xStroke; |
206 | innerStrokeScaleMat[5] = yInnRad - yStroke; | 198 | innerStrokeScaleMat[5] = yInnRad - yStroke; |
207 | 199 | ||
@@ -233,69 +225,24 @@ function GLCircle() | |||
233 | 225 | ||
234 | if (fillPrim) | 226 | if (fillPrim) |
235 | { | 227 | { |
236 | this._primArray.push( fillPrim ); | 228 | fillMaterial = this.makeFillMaterial(); |
237 | |||
238 | if (this.getFillMaterial()) | ||
239 | fillMaterial = this.getFillMaterial().dup(); | ||
240 | else | ||
241 | fillMaterial = new FlatMaterial(); | ||
242 | 229 | ||
243 | if (fillMaterial) | 230 | this._primArray.push( fillPrim ); |
244 | { | 231 | this._materialNodeArray.push( fillMaterial.getMaterialNode() ); |
245 | fillMaterial.init( this.getWorld() ); | ||
246 | if(!this.getFillMaterial() && this._fillColor) | ||
247 | { | ||
248 | fillMaterial.setProperty("color", this._fillColor); | ||
249 | } | ||
250 | this._materialArray.push( fillMaterial ); | ||
251 | this._materialTypeArray.push( "fill" ); | ||
252 | var matNode = fillMaterial.getMaterialNode(); | ||
253 | this._materialNodeArray.push( matNode ); | ||
254 | } | ||
255 | } | 232 | } |
256 | if (strokePrim0) | 233 | if (strokePrim0) |
257 | { |