aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements
diff options
context:
space:
mode:
Diffstat (limited to 'js/controllers/elements')
-rwxr-xr-xjs/controllers/elements/canvas-controller.js8
-rwxr-xr-xjs/controllers/elements/element-controller.js19
-rwxr-xr-xjs/controllers/elements/stage-controller.js58
3 files changed, 28 insertions, 57 deletions
diff --git a/js/controllers/elements/canvas-controller.js b/js/controllers/elements/canvas-controller.js
index b5df3911..7af7e824 100755
--- a/js/controllers/elements/canvas-controller.js
+++ b/js/controllers/elements/canvas-controller.js
@@ -33,13 +33,5 @@ exports.CanvasController = Montage.create(ElementController, {
33 ElementController.setProperty(el, p, value); 33 ElementController.setProperty(el, p, value);
34 } 34 }
35 } 35 }
36 },
37
38 setProperties: {
39 value: function(el, props, index) {
40 for(var p in props) {
41 el.elementModel.controller.setProperty(el, p, props[p][index]);
42 }
43 }
44 } 36 }
45}); \ No newline at end of file 37}); \ No newline at end of file
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js
index 0f17dd46..35a543ac 100755
--- a/js/controllers/elements/element-controller.js
+++ b/js/controllers/elements/element-controller.js
@@ -48,16 +48,6 @@ exports.ElementController = Montage.create(Component, {
48 48
49 setProperties: { 49 setProperties: {
50 value: function(element, properties) { 50 value: function(element, properties) {
51 /* Array of properties is not supported yet
52 if(Array.isArray(properties)) {
53
54 elements.forEach(function(property) {
55 this.application.ninja.stylesController.setElementStyle(element, p, props[p][index]);
56 });
57 } else {
58 }
59 */
60
61 for(var property in properties) { 51 for(var property in properties) {
62 this.application.ninja.stylesController.setElementStyle(element, property, properties[property]); 52 this.application.ninja.stylesController.setElementStyle(element, property, properties[property]);
63 } 53 }
@@ -239,15 +229,16 @@ exports.ElementController = Montage.create(Component, {
239 229
240 // TODO - perspective distance needs to be passed in as "dist" and matrix3d needs to be passed in as "mat" 230 // TODO - perspective distance needs to be passed in as "dist" and matrix3d needs to be passed in as "mat"
241 set3DProperties: { 231 set3DProperties: {
242 value: function(el, props, index, update3DModel) { 232 value: function(el, props, update3DModel) {
243 var dist = props[index]["dist"], 233 var dist = props["dist"],
244 mat = props[index]["mat"]; 234 mat = props["mat"];
235
245 this.application.ninja.stylesController.setElementStyle(el, "-webkit-transform", "matrix3d(" + MathUtils.scientificToDecimal(mat, 5) + ")"); 236 this.application.ninja.stylesController.setElementStyle(el, "-webkit-transform", "matrix3d(" + MathUtils.scientificToDecimal(mat, 5) + ")");
246 237
247 this.application.ninja.stylesController.setElementStyle(el, "-webkit-transform-style", "preserve-3d"); 238 this.application.ninja.stylesController.setElementStyle(el, "-webkit-transform-style", "preserve-3d");
248 239
249 // TODO - We don't support perspective on individual elements yet 240 // TODO - We don't support perspective on individual elements yet
250// this.application.ninja.stylesController.setElementStyle(el, "-webkit-perspective", dist); 241 // this.application.ninja.stylesController.setElementStyle(el, "-webkit-perspective", dist);
251 242
252 el.elementModel.props3D.matrix3d = mat; 243 el.elementModel.props3D.matrix3d = mat;
253 el.elementModel.props3D.perspectiveDist = dist; 244 el.elementModel.props3D.perspectiveDist = dist;
diff --git a/js/controllers/elements/stage-controller.js b/js/controllers/elements/stage-controller.js
index f376e40f..3ef7dacc 100755
--- a/js/controllers/elements/stage-controller.js
+++ b/js/controllers/elements/stage-controller.js
@@ -31,46 +31,34 @@ exports.StageController = Montage.create(ElementController, {
31 } 31 }
32 }, 32 },
33 33
34
34 // TODO - perspective distance needs to be passed in as "dist" and matrix3d needs to be passed in as "mat" 35 // TODO - perspective distance needs to be passed in as "dist" and matrix3d needs to be passed in as "mat"
35 set3DProperties: { 36 set3DProperties: {
36 value: function(el, props, index, update3DModel) { 37 value: function(el, props, update3DModel) {
37 var dist = props[index]["dist"], 38 var dist = props["dist"], mat = props["mat"];
38 mat = props[index]["mat"]; 39 this.application.ninja.stylesController.setElementStyle(el, "-webkit-transform", "perspective(" + dist + ") " + "matrix3d(" + MathUtils.scientificToDecimal(mat, 5) + ")", true);
39 this.application.ninja.stylesController.setElementStyle(el, 40
40 "-webkit-transform", 41 el.elementModel.props3D.matrix3d = mat;
41 "perspective(" + dist + ") " + 42 el.elementModel.props3D.perspectiveDist = dist;
42 "matrix3d(" + MathUtils.scientificToDecimal(mat, 5) + ")",
43 true);
44
45 el.elementModel.props3D.matrix3d = mat;
46 el.elementModel.props3D.perspectiveDist = dist;
47
48 // TODO - Move this to matrix class
49 if(this._isRotated(mat))
50 {
51 this.application.ninja.currentDocument.stageBG.style.display = "none";
52 }
53 else
54 {
55 this.application.ninja.stylesController.setElementStyle(this.application.ninja.currentDocument.stageBG,
56 "-webkit-transform",
57 "perspective(" + dist + ") " +
58 "matrix3d(" + MathUtils.scientificToDecimal(mat, 5) + ")",
59 true);
60
61 this.application.ninja.currentDocument.stageBG.elementModel.props3D.matrix3d = mat;
62 this.application.ninja.currentDocument.stageBG.elementModel.props3D.perspectiveDist = dist;
63 this.application.ninja.currentDocument.stageBG.style.display = "block";
64 }
65 43
66 this.application.ninja.stage.updatedStage = true; 44 // TODO - Move this to matrix class
45 if(this._isRotated(mat)) {
46 this.application.ninja.currentDocument.stageBG.style.display = "none";
47 } else {
48 this.application.ninja.stylesController.setElementStyle(this.application.ninja.currentDocument.stageBG, "-webkit-transform", "perspective(" + dist + ") " + "matrix3d(" + MathUtils.scientificToDecimal(mat, 5) + ")", true);
67 49
68 if(update3DModel) 50 this.application.ninja.currentDocument.stageBG.elementModel.props3D.matrix3d = mat;
69 { 51 this.application.ninja.currentDocument.stageBG.elementModel.props3D.perspectiveDist = dist;
70 this._update3DProperties(el, mat, dist); 52 this.application.ninja.currentDocument.stageBG.style.display = "block";
53 }
54
55 this.application.ninja.stage.updatedStage = true;
56
57 if(update3DModel) {
58 this._update3DProperties(el, mat, dist);
59 }
71 } 60 }
72 } 61 },
73 },
74 62
75 getProperty: { 63 getProperty: {
76 value: function(el, p) { 64 value: function(el, p) {