diff options
author | hwc487 | 2012-01-31 10:46:48 -0800 |
---|---|---|
committer | hwc487 | 2012-01-31 10:46:48 -0800 |
commit | aa1b4b78d9e1b9cc15529dbf7196b7ac8a88e260 (patch) | |
tree | 9fd0364c371b8c9bbe1620b9a5a58a45dd0574a9 /js | |
parent | 0b8d8b2eb595b64ef53440b949f3c5ec891daf8a (diff) | |
parent | 6066b9bda2990c9d6b4311d221b0d0c773b20f60 (diff) | |
download | ninja-aa1b4b78d9e1b9cc15529dbf7196b7ac8a88e260.tar.gz |
Merge branch 'ToolFixes' of github.com:mqg734/ninja-internal into working
Conflicts:
js/stage/stage.reel/stage.js
Diffstat (limited to 'js')
-rw-r--r-- | js/components/combobox.reel/combobox.js | 2 | ||||
-rw-r--r-- | js/components/radio.reel/radio.js | 6 | ||||
-rw-r--r-- | js/controllers/elements/element-controller.js | 59 | ||||
-rw-r--r-- | js/helper-classes/3D/draw-utils.js | 25 | ||||
-rw-r--r-- | js/helper-classes/Properties3D.js | 82 | ||||
-rw-r--r-- | js/mediators/element-mediator.js | 5 | ||||
-rw-r--r-- | js/models/properties-3d.js | 6 | ||||
-rw-r--r-- | js/stage/layout.js | 14 | ||||
-rw-r--r-- | js/stage/stage.reel/stage.js | 12 | ||||
-rw-r--r-- | js/tools/SelectionTool.js | 1 | ||||
-rw-r--r-- | js/tools/drawing-tool-base.js | 1 |
11 files changed, 84 insertions, 129 deletions
diff --git a/js/components/combobox.reel/combobox.js b/js/components/combobox.reel/combobox.js index f262bb06..a68a7d6b 100644 --- a/js/components/combobox.reel/combobox.js +++ b/js/components/combobox.reel/combobox.js | |||
@@ -67,7 +67,7 @@ exports.Combobox = Montage.create(Component, { | |||
67 | var e = document.createEvent("CustomEvent"); | 67 | var e = document.createEvent("CustomEvent"); |
68 | e.initEvent("change", true, true); | 68 | e.initEvent("change", true, true); |
69 | e.type = "change"; | 69 | e.type = "change"; |
70 | e._wasSetByCode = this._wasSetByCode; | 70 | e.wasSetByCode = this._wasSetByCode; |
71 | e.value = this._value; | 71 | e.value = this._value; |
72 | this.dispatchEvent(e); | 72 | this.dispatchEvent(e); |
73 | 73 | ||
diff --git a/js/components/radio.reel/radio.js b/js/components/radio.reel/radio.js index 954da3c4..c661ec11 100644 --- a/js/components/radio.reel/radio.js +++ b/js/components/radio.reel/radio.js | |||
@@ -41,7 +41,7 @@ exports.RadioGroup = Montage.create(Component, { | |||
41 | e = document.createEvent("CustomEvent"); | 41 | e = document.createEvent("CustomEvent"); |
42 | e.initEvent("change", true, true); | 42 | e.initEvent("change", true, true); |
43 | e.type = "change"; | 43 | e.type = "change"; |
44 | e._wasSetByCode = this._wasSetByCode; | 44 | e.wasSetByCode = this._wasSetByCode; |
45 | e.selectedIndex = i; | 45 | e.selectedIndex = i; |
46 | e.selectedItem = value; | 46 | e.selectedItem = value; |
47 | this.dispatchEvent(e); | 47 | this.dispatchEvent(e); |
@@ -77,7 +77,7 @@ exports.RadioGroup = Montage.create(Component, { | |||
77 | { | 77 | { |
78 | value:function(event) | 78 | value:function(event) |
79 | { | 79 | { |
80 | this._wasSetByCode = event._event._wasSetByCode; | 80 | this._wasSetByCode = event._event.wasSetByCode; |
81 | this.selectedItem = event._event.value; | 81 | this.selectedItem = event._event.value; |
82 | } | 82 | } |
83 | } | 83 | } |
@@ -126,7 +126,7 @@ exports.Radio = Montage.create(Component, { | |||
126 | var e = document.createEvent("CustomEvent"); | 126 | var e = document.createEvent("CustomEvent"); |
127 | e.initEvent("change", true, true); | 127 | e.initEvent("change", true, true); |
128 | e.type = "change"; | 128 | e.type = "change"; |
129 | e._wasSetByCode = this._wasSetByCode; | 129 | e.wasSetByCode = this._wasSetByCode; |
130 | e.value = this; | 130 | e.value = this; |
131 | this.dispatchEvent(e); | 131 | this.dispatchEvent(e); |
132 | 132 | ||
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index f254220c..30469db0 100644 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js | |||
@@ -127,36 +127,35 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, | |||
127 | } | 127 | } |
128 | else | 128 | else |
129 | { | 129 | { |
130 | // TODO - for now, just return the identity matrix | 130 | var mat; |
131 | return Matrix.I(4); | 131 | |
132 | // var mat; | 132 | if (el) |
133 | // | 133 | { |
134 | // if (elt) | 134 | var xformStr = this.application.ninja.elementMediator.getProperty(el, "-webkit-transform"); |
135 | // { | 135 | if (xformStr) |
136 | // var xformStr = ElementsMediator.getProperty(elt, "-webkit-transform"); | 136 | mat = this.transformStringToMat( xformStr ); |
137 | // if (xformStr) | 137 | if (!mat) |
138 | // mat = this.transformStringToMat( xformStr ); | 138 | mat = Matrix.I(4); |
139 | // if (!mat) | 139 | |
140 | // mat = Matrix.I(4); | 140 | var zoom = this.application.ninja.elementMediator.getProperty(el, "zoom"); |
141 | // | 141 | if (zoom) |
142 | // if (elt.style && elt.style.zoom) | 142 | { |
143 | // { | 143 | zoom = Number(zoom); |
144 | // var zoom = Number(elt.style.zoom); | 144 | if (zoom != 1) |
145 | // if (zoom != 1) | 145 | { |
146 | // { | 146 | var zoomMat = Matrix.create( [ |
147 | // var zoomMat = Matrix.create( [ | 147 | [ zoom, 0, 0, 0], |
148 | // [ zoom, 0, 0, 0], | 148 | [ 0, zoom, 0, 0], |
149 | // [ 0, zoom, 0, 0], | 149 | [ 0, 0, zoom, 0], |
150 | // [ 0, 0, zoom, 0], | 150 | [ 0, 0, 0, 1] |
151 | // [ 0, 0, 0, 1] | 151 | ] ); |
152 | // ] ); | 152 | glmat4.multiply( zoomMat, mat, mat ); |
153 | // glmat4.multiply( zoomMat, mat, mat ); | 153 | } |
154 | // } | 154 | } |
155 | // } | 155 | } |
156 | // } | 156 | |
157 | // | 157 | el.elementModel.props3D.matrix3d = mat; |
158 | // elt.elementModel.props3D.matrix3d = mat; | 158 | return mat; |
159 | // return mat; | ||
160 | } | 159 | } |
161 | } | 160 | } |
162 | }, | 161 | }, |
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 | ||