diff options
author | Valerio Virgillito | 2012-02-02 15:12:03 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-02-02 15:12:03 -0800 |
commit | 4c6ea2383650ae328ed1e69c5f9c7c6878c6f810 (patch) | |
tree | 1f4194554032bee6a87aadf15cb647398a98b437 | |
parent | 7303d3a7c3913658bf33be5f99db85a30889cfd9 (diff) | |
parent | d41dee0c552a30724a146965ae4272a268777fc5 (diff) | |
download | ninja-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.
-rw-r--r-- | js/components/tools-properties/rect-properties.reel/rect-properties.js | 2 | ||||
-rw-r--r-- | js/controllers/elements/canvas-controller.js | 14 | ||||
-rw-r--r-- | js/controllers/elements/element-controller.js | 61 | ||||
-rw-r--r-- | js/controllers/elements/shapes-controller.js | 28 | ||||
-rw-r--r-- | js/data/pi/pi-data.js | 48 | ||||
-rw-r--r-- | js/helper-classes/3D/draw-utils.js | 28 | ||||
-rw-r--r-- | js/helper-classes/3D/math-utils.js | 54 | ||||
-rw-r--r-- | js/helper-classes/3D/snap-manager.js | 11 | ||||
-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/panels/properties/content.reel/content.js | 7 | ||||
-rw-r--r-- | js/panels/properties/sections/three-d-view.reel/three-d-view.html | 12 | ||||
-rw-r--r-- | js/panels/properties/sections/three-d-view.reel/three-d-view.js | 86 | ||||
-rw-r--r-- | js/stage/layout.js | 14 | ||||
-rw-r--r-- | js/stage/stage.reel/stage.js | 63 | ||||
-rw-r--r-- | js/tools/PanTool.js | 33 | ||||
-rw-r--r-- | js/tools/SelectionTool.js | 1 | ||||
-rw-r--r-- | js/tools/ZoomTool.js | 39 | ||||
-rw-r--r-- | js/tools/drawing-tool-base.js | 1 |
20 files changed, 325 insertions, 270 deletions
diff --git a/js/components/tools-properties/rect-properties.reel/rect-properties.js b/js/components/tools-properties/rect-properties.reel/rect-properties.js index 8d0cd21f..1e717f88 100644 --- a/js/components/tools-properties/rect-properties.reel/rect-properties.js +++ b/js/components/tools-properties/rect-properties.reel/rect-properties.js | |||
@@ -113,7 +113,7 @@ exports.RectProperties = Montage.create(ToolProperties, { | |||
113 | 113 | ||
114 | handleChange: { | 114 | handleChange: { |
115 | value: function(event) { | 115 | value: function(event) { |
116 | var hotTxt = event.currentTarget | 116 | var hotTxt = event.currentTarget; |
117 | if(hotTxt.units === "%") { | 117 | if(hotTxt.units === "%") { |
118 | if(hotTxt.value > 50) { | 118 | if(hotTxt.value > 50) { |
119 | hotTxt.maxValue = 50; | 119 | hotTxt.maxValue = 50; |
diff --git a/js/controllers/elements/canvas-controller.js b/js/controllers/elements/canvas-controller.js index 21de9879..b5df3911 100644 --- a/js/controllers/elements/canvas-controller.js +++ b/js/controllers/elements/canvas-controller.js | |||
@@ -34,12 +34,12 @@ exports.CanvasController = Montage.create(ElementController, { | |||
34 | } | 34 | } |
35 | } | 35 | } |
36 | }, | 36 | }, |
37 | 37 | ||
38 | setProperties: { | 38 | setProperties: { |
39 | value: function(el, props, index) { | 39 | value: function(el, props, index) { |
40 | for(var p in props) { | 40 | for(var p in props) { |
41 | el.elementModel.controller.setProperty(el, p, props[p][index]); | 41 | el.elementModel.controller.setProperty(el, p, props[p][index]); |
42 | } | 42 | } |
43 | } | 43 | } |
44 | } | 44 | } |
45 | }); \ No newline at end of file | 45 | }); \ No newline at end of file |
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index f254220c..f2b54014 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 | }, |
@@ -207,7 +206,7 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, | |||
207 | el.elementModel.props3D.matrix3d = mat; | 206 | el.elementModel.props3D.matrix3d = mat; |
208 | el.elementModel.props3D.perspectiveDist = dist; | 207 | el.elementModel.props3D.perspectiveDist = dist; |
209 | 208 | ||
210 | // if(update3DModel) | 209 | if(update3DModel) |
211 | { | 210 | { |
212 | this._update3DProperties(el, mat, dist); | 211 | this._update3DProperties(el, mat, dist); |
213 | } | 212 | } |
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index d34644a7..c5f22138 100644 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js | |||
@@ -24,6 +24,26 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
24 | el.elementModel.shapeModel.GLGeomObj.setInnerRadius(val/100); | 24 | el.elementModel.shapeModel.GLGeomObj.setInnerRadius(val/100); |
25 | el.elementModel.shapeModel.GLGeomObj.buildBuffers(); | 25 | el.elementModel.shapeModel.GLGeomObj.buildBuffers(); |
26 | break; | 26 | break; |
27 | case "tlRadius": | ||
28 | this.setShapeProperty(el, "tlRadius", value); | ||
29 | el.elementModel.shapeModel.GLGeomObj.setTLRadius(val); | ||
30 | el.elementModel.shapeModel.GLGeomObj.buildBuffers(); | ||
31 | break; | ||
32 | case "trRadius": | ||
33 | this.setShapeProperty(el, "trRadius", value); | ||
34 | el.elementModel.shapeModel.GLGeomObj.setTRRadius(val); | ||
35 | el.elementModel.shapeModel.GLGeomObj.buildBuffers(); | ||
36 | break; | ||
37 | case "blRadius": | ||
38 | this.setShapeProperty(el, "blRadius", value); | ||
39 | el.elementModel.shapeModel.GLGeomObj.setBLRadius(val); | ||
40 | el.elementModel.shapeModel.GLGeomObj.buildBuffers(); | ||
41 | break; | ||
42 | case "brRadius": | ||
43 | this.setShapeProperty(el, "brRadius", value); | ||
44 | el.elementModel.shapeModel.GLGeomObj.setBRRadius(val); | ||
45 | el.elementModel.shapeModel.GLGeomObj.buildBuffers(); | ||
46 | break; | ||
27 | case "width": | 47 | case "width": |
28 | el.elementModel.shapeModel.GLGeomObj.setWidth(val); | 48 | el.elementModel.shapeModel.GLGeomObj.setWidth(val); |
29 | CanvasController.setProperty(el, p, value); | 49 | CanvasController.setProperty(el, p, value); |
@@ -46,8 +66,16 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
46 | getProperty: { | 66 | getProperty: { |
47 | value: function(el, p) { | 67 | value: function(el, p) { |
48 | switch(p) { | 68 | switch(p) { |
69 | case "stroke": | ||
70 | case "fill": | ||
49 | case "strokeSize": | 71 | case "strokeSize": |
50 | case "innerRadius": | 72 | case "innerRadius": |
73 | case "tlRadius": | ||
74 | case "trRadius": | ||
75 | case "blRadius": | ||
76 | case "brRadius": | ||
77 | case "strokeMaterial": | ||
78 | case "fillMaterial": | ||
51 | return this.getShapeProperty(el, p); | 79 | return this.getShapeProperty(el, p); |
52 | default: | 80 | default: |
53 | return CanvasController.getProperty(el, p); | 81 | return CanvasController.getProperty(el, p); |
diff --git a/js/data/pi/pi-data.js b/js/data/pi/pi-data.js index f162e919..de5cd34d 100644 --- a/js/data/pi/pi-data.js +++ b/js/data/pi/pi-data.js | |||
@@ -279,11 +279,13 @@ exports.PiData = Montage.create( Montage, { | |||
279 | [ | 279 | [ |
280 | { | 280 | { |
281 | type : "color", | 281 | type : "color", |
282 | id : "stroke" | 282 | id : "stroke", |
283 | prop : "stroke" | ||
283 | }, | 284 | }, |
284 | { | 285 | { |
285 | type : "color", | 286 | type : "color", |
286 | id : "fill", | 287 | id : "fill", |
288 | prop : "fill", | ||
287 | divider : true | 289 | divider : true |
288 | } | 290 | } |
289 | ], | 291 | ], |
@@ -313,10 +315,11 @@ exports.PiData = Montage.create( Montage, { | |||
313 | id: "tlRadius", | 315 | id: "tlRadius", |
314 | prop : "tlRadius", | 316 | prop : "tlRadius", |
315 | label: "TL", | 317 | label: "TL", |
318 | valueMutator: parseFloat, | ||
316 | value : 0, | 319 | value : 0, |