aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/helper-classes/3D/draw-utils.js34
-rw-r--r--js/mediators/element-mediator.js6
-rw-r--r--js/panels/Color/colortoolbar.reel/colortoolbar.js8
-rw-r--r--js/stage/layout.js4
4 files changed, 44 insertions, 8 deletions
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js
index fd96af4d..fe617548 100644
--- a/js/helper-classes/3D/draw-utils.js
+++ b/js/helper-classes/3D/draw-utils.js
@@ -71,6 +71,9 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
71 71
72 _selectionCtr : {value: null, writable: true }, 72 _selectionCtr : {value: null, writable: true },
73 73
74 // Properties that require element planes to be updated
75 _updatePlaneProps : {value: ["matrix", "left", "top", "width", "height"], writable: false },
76
74 /////////////////////////////////////////////////////////////////////// 77 ///////////////////////////////////////////////////////////////////////
75 // Property accessors 78 // Property accessors
76 /////////////////////////////////////////////////////////////////////// 79 ///////////////////////////////////////////////////////////////////////
@@ -124,11 +127,38 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
124 } 127 }
125 }, 128 },
126 129
130 _shouldUpdatePlanes: {
131 value: function(props) {
132 if(!props)
133 {
134 return false;
135 }
136 else if (typeof props === "string")
137 {
138 return (this._updatePlaneProps.indexOf(props) !== -1);
139 }
140
141 for (var p in props)
142 {
143 if(this._updatePlaneProps.indexOf(p) !== -1)
144 {
145 return true;
146 }
147 }
148
149 return false;
150 }
151 },
127 152
153 // TODO - Check why handleElementChange is being fired before handleAddElement
128 handleElementChange: { 154 handleElementChange: {
129 value: function(event) { 155 value: function(event) {
156 if(!event.detail || !event.detail.data)
157 {
158 return;
159 }
130 var els = event.detail.data.els; 160 var els = event.detail.data.els;
131 if(els) 161 if(els && this._shouldUpdatePlanes(event.detail.data.prop))
132 { 162 {
133 var len = els.length, 163 var len = els.length,
134 i = 0, 164 i = 0,
@@ -141,7 +171,9 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
141 el.elementModel.props3D.elementPlane.init(); 171 el.elementModel.props3D.elementPlane.init();
142 } 172 }
143 173
174 this.application.ninja.stage.layout.draw();
144 this.drawWorkingPlane(); 175 this.drawWorkingPlane();
176 this.draw3DCompass();
145 } 177 }
146 } 178 }
147 }, 179 },
diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js
index 1d0aef44..b2bc5355 100644
--- a/js/mediators/element-mediator.js
+++ b/js/mediators/element-mediator.js
@@ -425,7 +425,7 @@ exports.ElementMediator = Montage.create(NJComponent, {
425 el.elementModel.controller["set3DProperties"](el, props, i, update3DModel); 425 el.elementModel.controller["set3DProperties"](el, props, i, update3DModel);
426 } 426 }
427 427
428 NJevent("element" + eventType, {type : "set3DProperties", source: source, data: {"els": els, "prop": props, "value": props}, redraw: null}); 428 NJevent("element" + eventType, {type : "set3DProperties", source: source, data: {"els": els, "prop": "matrix", "value": props}, redraw: null});
429 } 429 }
430 }, 430 },
431 431
@@ -660,11 +660,11 @@ exports.ElementMediator = Montage.create(NJComponent, {
660 660
661 if(isChanging) 661 if(isChanging)
662 { 662 {
663 NJevent("elementChanging", {type : "setMatrix", source: null, data: {"el": el, "prop": "matrix", "value": mat}, redraw: null}); 663 NJevent("elementChanging", {type : "setMatrix", source: null, data: {"els": [el], "prop": "matrix", "value": mat}, redraw: null});
664 } 664 }
665 else 665 else
666 { 666 {
667 NJevent("elementChange", {type : "setMatrix", source: null, data: {"el": el, "prop": "matrix", "value": mat}, redraw: null}); 667 NJevent("elementChange", {type : "setMatrix", source: null, data: {"els": [el], "prop": "matrix", "value": mat}, redraw: null});
668 } 668 }
669 } 669 }
670 }, 670 },
diff --git a/js/panels/Color/colortoolbar.reel/colortoolbar.js b/js/panels/Color/colortoolbar.reel/colortoolbar.js
index 10ae8b6e..6b8e476b 100644
--- a/js/panels/Color/colortoolbar.reel/colortoolbar.js
+++ b/js/panels/Color/colortoolbar.reel/colortoolbar.js
@@ -20,7 +20,7 @@ exports.ColorToolbar = Montage.create(Component, {
20 //Storing stroke (stores color in mode use to select color) 20 //Storing stroke (stores color in mode use to select color)
21 _stroke: { 21 _stroke: {
22 enumerable: false, 22 enumerable: false,
23 value: {colorMode: 'rgb', color: {r: 0, g: 0, b: 0, a: 1, css: 'rgb(0,0,0)', mode:'rgb', wasSetByCode: false, type: 'change'}, webGlColor: [0, 0, 0, 1]} 23 value: {colorMode: 'rgb', color: {r: 0, g: 0, b: 0, a: 1, css: 'rgb(0,0,0)', mode:'rgb', wasSetByCode: true, type: 'change'}, webGlColor: [0, 0, 0, 1]}
24 }, 24 },
25 //////////////////////////////////////////////////////////////////// 25 ////////////////////////////////////////////////////////////////////
26 // 26 //
@@ -39,7 +39,7 @@ exports.ColorToolbar = Montage.create(Component, {
39 //Storing fill (stores color in mode use to select color) 39 //Storing fill (stores color in mode use to select color)
40 _fill: { 40 _fill: {
41 enumerable: false, 41 enumerable: false,
42 value: {colorMode: 'rgb', color: {r: 255, g: 255, b: 255, a: 1, css: 'rgb(255,255,255)', mode:'rgb', wasSetByCode: false, type: 'change'}, webGlColor: [1, 1, 1, 1]} 42 value: {colorMode: 'rgb', color: {r: 255, g: 255, b: 255, a: 1, css: 'rgb(255,255,255)', mode:'rgb', wasSetByCode: true, type: 'change'}, webGlColor: [1, 1, 1, 1]}
43 }, 43 },
44 //////////////////////////////////////////////////////////////////// 44 ////////////////////////////////////////////////////////////////////
45 // 45 //
@@ -86,8 +86,8 @@ exports.ColorToolbar = Montage.create(Component, {
86 this.application.ninja.colorController.addButton('chip', this.fill_btn); 86 this.application.ninja.colorController.addButton('chip', this.fill_btn);
87 this.application.ninja.colorController.addButton('chip', this.stroke_btn); 87 this.application.ninja.colorController.addButton('chip', this.stroke_btn);
88 // 88 //
89 this.fill_btn.color('rgb', {wasSetByCode: false, type: 'change', color: {r: 255, g: 255, b: 255}, css: 'rgb(255,255,255)'}); 89 this.fill_btn.color('rgb', {wasSetByCode: true, type: 'change', color: {r: 255, g: 255, b: 255}, css: 'rgb(255,255,255)'});
90 this.stroke_btn.color('rgb', {wasSetByCode: false, type: 'change', color: {r: 0, g: 0, b: 0}, css: 'rgb(0,0,0)'}); 90 this.stroke_btn.color('rgb', {wasSetByCode: true, type: 'change', color: {r: 0, g: 0, b: 0}, css: 'rgb(0,0,0)'});
91 } 91 }
92 }, 92 },
93 //////////////////////////////////////////////////////////////////// 93 ////////////////////////////////////////////////////////////////////
diff --git a/js/stage/layout.js b/js/stage/layout.js
index dd5be081..c369fc30 100644
--- a/js/stage/layout.js
+++ b/js/stage/layout.js
@@ -74,6 +74,9 @@ exports.Layout = Montage.create(Component, {
74 handleElementAdded: { 74 handleElementAdded: {
75 value: function(event) { 75 value: function(event) {
76 this.domTree.push(event.detail); 76 this.domTree.push(event.detail);
77
78 this.draw();
79 this.draw3DInfo(false);
77 } 80 }
78 }, 81 },
79 82
@@ -82,6 +85,7 @@ exports.Layout = Montage.create(Component, {
82 this.domTree.splice(this.domTree.indexOf(event.detail), 1); 85 this.domTree.splice(this.domTree.indexOf(event.detail), 1);
83 86
84 this.draw(); 87 this.draw();
88 this.draw3DInfo(false);
85 } 89 }
86 }, 90 },
87 91