diff options
author | Jonathan Duran | 2012-03-23 07:24:39 -0700 |
---|---|---|
committer | Jonathan Duran | 2012-03-23 07:24:39 -0700 |
commit | 846d539997bf188b9caf63cdf0008367fe6c9ede (patch) | |
tree | ae0ed9293cd5859cd10694fb2e045b2101ed8df8 /js/controllers/elements | |
parent | 595a569cf459e7e7cbe19e546c23322b56e44341 (diff) | |
parent | 57cc00a5ef3ab525e54a030d7692b2d9eefaa68b (diff) | |
download | ninja-846d539997bf188b9caf63cdf0008367fe6c9ede.tar.gz |
Merge branch 'refs/heads/NINJAmaster' into TimelineUber
Diffstat (limited to 'js/controllers/elements')
-rwxr-xr-x | js/controllers/elements/element-controller.js | 33 | ||||
-rwxr-xr-x | js/controllers/elements/shapes-controller.js | 13 | ||||
-rwxr-xr-x | js/controllers/elements/stage-controller.js | 41 |
3 files changed, 50 insertions, 37 deletions
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index 9f00604f..b35251ad 100755 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js | |||
@@ -51,23 +51,6 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, | |||
51 | 51 | ||
52 | setAttribute: { | 52 | setAttribute: { |
53 | value: function(el, att, value) { | 53 | value: function(el, att, value) { |
54 | if(att === "id") { | ||
55 | if(value === "") { | ||
56 | el.setAttribute(att, value); | ||
57 | return; | ||
58 | } | ||
59 | |||
60 | // Then check if this is a valid id by the following spec: http://www.w3.org/TR/REC-html40/types.html#h-6.2 | ||
61 | var regexID = /^([a-zA-Z])+([a-zA-Z0-9_\.\:\-])+/; | ||
62 | if(!regexID.test(value)) { | ||
63 | alert("Invalid ID"); | ||
64 | return; | ||
65 | } else if (this.application.ninja.currentDocument._document.getElementById(value) !== null) { | ||
66 | alert("The following ID: " + value + " is already in Use"); | ||
67 | } | ||
68 | |||
69 | } | ||
70 | |||
71 | el.setAttribute(att, value); | 54 | el.setAttribute(att, value); |
72 | } | 55 | } |
73 | }, | 56 | }, |
@@ -245,22 +228,6 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, | |||
245 | mat = this.transformStringToMat( xformStr ); | 228 | mat = this.transformStringToMat( xformStr ); |
246 | if (!mat) | 229 | if (!mat) |
247 | mat = Matrix.I(4); | 230 | mat = Matrix.I(4); |
248 | |||
249 | var zoom = this.application.ninja.elementMediator.getProperty(el, "zoom"); | ||
250 | if (zoom) | ||
251 | { | ||
252 | zoom = Number(zoom); | ||
253 | if (zoom != 1) | ||
254 | { | ||
255 | var zoomMat = Matrix.create( [ | ||
256 | [ zoom, 0, 0, 0], | ||
257 | [ 0, zoom, 0, 0], | ||
258 | [ 0, 0, zoom, 0], | ||
259 | [ 0, 0, 0, 1] | ||
260 | ] ); | ||
261 | glmat4.multiply( zoomMat, mat, mat ); | ||
262 | } | ||
263 | } | ||
264 | } | 231 | } |
265 | 232 | ||
266 | el.elementModel.props3D.matrix3d = mat; | 233 | el.elementModel.props3D.matrix3d = mat; |
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index d72d9c14..b3ac9ddb 100755 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js | |||
@@ -6,10 +6,9 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
6 | 6 | ||
7 | var Montage = require("montage/core/core").Montage, | 7 | var Montage = require("montage/core/core").Montage, |
8 | CanvasController = require("js/controllers/elements/canvas-controller").CanvasController, | 8 | CanvasController = require("js/controllers/elements/canvas-controller").CanvasController, |
9 | njModule = require("js/lib/NJUtils"); | 9 | njModule = require("js/lib/NJUtils"), |
10 | 10 | World = require("js/lib/drawing/world").World, | |
11 | var World = require("js/lib/drawing/world").World; | 11 | MaterialsModel = require("js/models/materials-model").MaterialsModel; |
12 | var MaterialsModel = require("js/models/materials-model").MaterialsModel; | ||
13 | 12 | ||
14 | exports.ShapesController = Montage.create(CanvasController, { | 13 | exports.ShapesController = Montage.create(CanvasController, { |
15 | 14 | ||
@@ -100,6 +99,12 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
100 | el.elementModel.shapeModel.GLWorld.render(); | 99 | el.elementModel.shapeModel.GLWorld.render(); |
101 | } | 100 | } |
102 | break; | 101 | break; |
102 | case "editStrokeMaterial": | ||
103 | NJevent("showMaterialPopup",{materialId : el.elementModel.shapeModel.strokeMaterial.getName()}); | ||
104 | break; | ||
105 | case "editFillMaterial": | ||
106 | NJevent("showMaterialPopup",{materialId : el.elementModel.shapeModel.fillMaterial.getName()}); | ||
107 | break; | ||
103 | default: | 108 | default: |
104 | CanvasController.setProperty(el, p, value); | 109 | CanvasController.setProperty(el, p, value); |
105 | } | 110 | } |
diff --git a/js/controllers/elements/stage-controller.js b/js/controllers/elements/stage-controller.js index 34bb1fb5..97ea3aa5 100755 --- a/js/controllers/elements/stage-controller.js +++ b/js/controllers/elements/stage-controller.js | |||
@@ -129,5 +129,46 @@ exports.StageController = Montage.create(ElementController, { | |||
129 | value: function(el, rule, selector) { | 129 | value: function(el, rule, selector) { |
130 | el.elementModel.transitionStopRule.selectorText = selector; | 130 | el.elementModel.transitionStopRule.selectorText = selector; |
131 | } | 131 | } |
132 | }, | ||
133 | |||
134 | getMatrix: { | ||
135 | value: function(el) { | ||
136 | if(el.elementModel && el.elementModel.props3D && el.elementModel.props3D.matrix3d) | ||
137 | { | ||
138 | return el.elementModel.props3D.matrix3d.slice(0); | ||
139 | } | ||
140 | else | ||
141 | { | ||
142 | var mat; | ||
143 | |||
144 | if (el) | ||
145 | { | ||
146 | var xformStr = this.application.ninja.elementMediator.getProperty(el, "-webkit-transform"); | ||
147 | if (xformStr) | ||
148 | mat = this.transformStringToMat( xformStr ); | ||
149 | if (!mat) | ||
150 | mat = Matrix.I(4); | ||
151 | |||
152 | var zoom = this.application.ninja.elementMediator.getProperty(el, "zoom"); | ||
153 | if (zoom) | ||
154 | { | ||
155 | zoom = Number(zoom); | ||
156 | if (zoom != 1) | ||
157 | { | ||
158 | var zoomMat = Matrix.create( [ | ||
159 | [ zoom, 0, 0, 0], | ||
160 | [ 0, zoom, 0, 0], | ||
161 | [ 0, 0, zoom, 0], | ||
162 | [ 0, 0, 0, 1] | ||
163 | ] ); | ||
164 | glmat4.multiply( zoomMat, mat, mat ); | ||
165 | } | ||
166 | } | ||
167 | } | ||
168 | |||
169 | el.elementModel.props3D.matrix3d = mat; | ||
170 | return mat; | ||
171 | } | ||
172 | } | ||
132 | } | 173 | } |
133 | }); | 174 | }); |