diff options
Diffstat (limited to 'js/helper-classes')
-rw-r--r-- | js/helper-classes/3D/draw-utils.js | 25 | ||||
-rw-r--r-- | js/helper-classes/Properties3D.js | 82 |
2 files changed, 25 insertions, 82 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/helper-classes/Properties3D.js b/js/helper-classes/Properties3D.js deleted file mode 100644 index 42499877..00000000 --- a/js/helper-classes/Properties3D.js +++ /dev/null | |||
@@ -1,82 +0,0 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | |||
7 | /* Class that holds all 3d properties per element. | ||
8 | */ | ||
9 | |||
10 | exports.Properties3D = Object.create(Object.prototype, { | ||
11 | m_element : {value : null, writable:true, enumerable:true, configurable:true}, | ||
12 | |||
13 | // m_upVector : {value : Vector.create( [0,1,0] ), writable: true, enumerable: true, configurable: true}, | ||
14 | m_azimuth : {value : 0.0, writable: true, enumerable: true, configurable: true}, | ||
15 | m_altitude : {value : 0.0, writable: true, enumerable: true, configurable: true}, | ||
16 | |||
17 | m_transformCtr : {value : null, writable: true, enumerable: true, configurable: true}, | ||
18 | // m_targetPos : {value : Vector.create( [0,0,0] ), writable: true, enumerable: true, configurable: true}, | ||
19 | |||
20 | m_endAzimuth : {value : 0, writable: true, enumerable: true, configurable: true}, | ||
21 | m_endAltitude : {value : 0, writable: true, enumerable: true, configurable: true}, | ||
22 | |||
23 | // m_objStartPos : {value : Vector.create( [0,0,0] ), writable: true, enumerable: true, configurable: true}, | ||
24 | |||
25 | //TODO - not sure if this should be part of the tool or stage or a utility | ||
26 | perspectiveDist : { value : 1400, writable: true, enumerable: true, configurable: true}, | ||
27 | |||
28 | // keep a referenceto the GLWorld (if any) | ||
29 | _world : {value : null, writable:true, enumerable:true, configurable:true}, | ||
30 | |||
31 | // keep a flag indicating the element is in the 2D snap cache | ||
32 | _eltIsIn2DSnapCache : { value: false, writable: true, enumerable: true, configurable: true}, | ||
33 | |||
34 | Init : { | ||
35 | value : function(elt) | ||
36 | { | ||
37 | this.m_element = elt; | ||
38 | |||
39 | this.m_azimuth = 0.0; | ||
40 | this.m_altitude = 0.0; | ||
41 | |||
42 | this.m_endAzimuth = 0.0; | ||
43 | this.m_endAltitude = 0.0; | ||
44 | |||
45 | // this.m_upVector = Vector.create( [0,1,0] ); | ||
46 | // this.m_viewDir = Vector.create( [0,0,1] ); | ||
47 | // this.m_endUpVector = Vector.create( [0,1,0] ); | ||
48 | |||
49 | this.m_transformCtr = null; | ||
50 | // this.m_targetPos = Vector.create( [0,0,0] ); | ||
51 | |||
52 | // this.m_objStartPos = Vector.create( [0,0,0] ); | ||
53 | |||
54 | this.perspectiveDist = 1400; | ||
55 | } | ||
56 | }, | ||
57 | |||
58 | ResetRotationValues : { | ||
59 | value : function(elt) | ||
60 | { | ||
61 | // this.m_upVector = Vector.create( [0,1,0] ); | ||
62 | // this.m_viewDir = Vector.create( [0,0,1] ); | ||
63 | |||
64 | this.m_azimuth = 0.0; | ||
65 | this.m_altitude = 0.0; | ||
66 | |||
67 | this.m_endAzimuth = 0.0; | ||
68 | this.m_endAltitude = 0.0; | ||
69 | |||
70 | this.m_transformCtr = null; | ||
71 | // this.m_targetPos = Vector.create( [0,0,0] ); | ||
72 | } | ||
73 | }, | ||
74 | |||
75 | ResetTranslationValues : { | ||
76 | value : function(elt) | ||
77 | { | ||
78 | // this.m_objStartPos = Vector.create( [0,0,0] ); | ||
79 | this.perspectiveDist = 1400; | ||
80 | } | ||
81 | } | ||
82 | }); \ No newline at end of file | ||