aboutsummaryrefslogtreecommitdiff
path: root/js/mediators/element-mediator.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/mediators/element-mediator.js')
-rwxr-xr-xjs/mediators/element-mediator.js42
1 files changed, 3 insertions, 39 deletions
diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js
index 1d5e9ade..cecb4392 100755
--- a/js/mediators/element-mediator.js
+++ b/js/mediators/element-mediator.js
@@ -29,15 +29,12 @@ exports.ElementMediator = Montage.create(Component, {
29 if(Array.isArray(elements)) { 29 if(Array.isArray(elements)) {
30 elements.forEach(function(element) { 30 elements.forEach(function(element) {
31 ElementController.addElement(element, rules); 31 ElementController.addElement(element, rules);
32 if(element.elementModel && element.elementModel.props3D) { 32 element.elementModel.props3D.init(element, false);
33 element.elementModel.props3D.init(element, false);
34 }
35 }); 33 });
36 } else { 34 } else {
37 ElementController.addElement(elements, rules); 35 ElementController.addElement(elements, rules);
38 if(elements.elementModel && elements.elementModel.props3D) { 36 elements.elementModel.props3D.init(elements, false);
39 elements.elementModel.props3D.init(elements, false); 37
40 }
41 } 38 }
42 39
43 if(this.addDelegate && typeof (this.addDelegate['onAddElements']) === "function") { 40 if(this.addDelegate && typeof (this.addDelegate['onAddElements']) === "function") {
@@ -102,11 +99,6 @@ exports.ElementMediator = Montage.create(Component, {
102 99
103 getProperty: { 100 getProperty: {
104 value: function(el, prop, valueMutator) { 101 value: function(el, prop, valueMutator) {
105 if(!el.elementModel) {
106 console.log("Element has no Model -> One should have been created");
107 NJUtils.makeElementModel(el, "Div", "block");
108 }
109
110 if(valueMutator && typeof valueMutator === "function") { 102 if(valueMutator && typeof valueMutator === "function") {
111 return valueMutator(el.elementModel.controller["getProperty"](el, prop)); 103 return valueMutator(el.elementModel.controller["getProperty"](el, prop));
112 } else { 104 } else {
@@ -117,22 +109,12 @@ exports.ElementMediator = Montage.create(Component, {
117 109
118 getShapeProperty: { 110 getShapeProperty: {
119 value: function(el, prop) { 111 value: function(el, prop) {
120 if(!el.elementModel) {
121 console.log("Element has no Model -> One should have been created");
122 NJUtils.makeElementModel(el, "Canvas", "block", true);
123 }
124
125 return el.elementModel.controller["getShapeProperty"](el, prop); 112 return el.elementModel.controller["getShapeProperty"](el, prop);
126 } 113 }
127 }, 114 },
128 115
129 setShapeProperty: { 116 setShapeProperty: {
130 value: function(el, prop, value) { 117 value: function(el, prop, value) {
131 if(!el.elementModel) {
132 console.log("Element has no Model -> One should have been created");
133 NJUtils.makeElementModel(el, "Canvas", "block", true);
134 }
135
136 return el.elementModel.controller["setShapeProperty"](el, prop, value); 118 return el.elementModel.controller["setShapeProperty"](el, prop, value);
137 } 119 }
138 }, 120 },
@@ -297,9 +279,6 @@ exports.ElementMediator = Montage.create(Component, {
297 // Routines to get/set color 279 // Routines to get/set color
298 getColor: { 280 getColor: {
299 value: function(el, isFill, borderSide) { 281 value: function(el, isFill, borderSide) {
300 if(!el.elementModel) {
301 NJUtils.makeModelFromElement(el);
302 }
303 return el.elementModel.controller["getColor"](el, isFill, borderSide); 282 return el.elementModel.controller["getColor"](el, isFill, borderSide);
304 } 283 }
305 }, 284 },
@@ -374,9 +353,6 @@ exports.ElementMediator = Montage.create(Component, {
374 353
375 getStroke: { 354 getStroke: {
376 value: function(el) { 355 value: function(el) {
377 if(!el.elementModel) {
378 NJUtils.makeElementModel(el, "Div", "block");
379 }
380 return el.elementModel.controller["getStroke"](el); 356 return el.elementModel.controller["getStroke"](el);
381 } 357 }
382 }, 358 },
@@ -452,18 +428,12 @@ exports.ElementMediator = Montage.create(Component, {
452 // Routines to get/set 3D properties 428 // Routines to get/set 3D properties
453 get3DProperty: { 429 get3DProperty: {
454 value: function(el, prop) { 430 value: function(el, prop) {
455 if(!el.elementModel) {
456 NJUtils.makeModelFromElement(el);
457 }
458 return el.elementModel.controller["get3DProperty"](el, prop); 431 return el.elementModel.controller["get3DProperty"](el, prop);
459 } 432 }
460 }, 433 },
461 434
462 get3DProperties: { 435 get3DProperties: {
463 value: function(el) { 436 value: function(el) {
464 if(!el.elementModel) {
465 NJUtils.makeModelFromElement(el);
466 }
467// var mat = this.getMatrix(el); 437// var mat = this.getMatrix(el);
468// var dist = this.getPerspectiveDist(el); 438// var dist = this.getPerspectiveDist(el);
469 var mat = el.elementModel.controller["getMatrix"](el); 439 var mat = el.elementModel.controller["getMatrix"](el);
@@ -474,18 +444,12 @@ exports.ElementMediator = Montage.create(Component, {
474 444
475 getMatrix: { 445 getMatrix: {
476 value: function(el) { 446 value: function(el) {
477 if(!el.elementModel) {
478 NJUtils.makeModelFromElement(el);
479 }
480 return el.elementModel.controller["getMatrix"](el); 447 return el.elementModel.controller["getMatrix"](el);
481 } 448 }
482 }, 449 },
483 450
484 getPerspectiveDist: { 451 getPerspectiveDist: {
485 value: function(el) { 452 value: function(el) {
486 if(!el.elementModel) {
487 NJUtils.makeModelFromElement(el);
488 }
489 return el.elementModel.controller["getPerspectiveDist"](el); 453 return el.elementModel.controller["getPerspectiveDist"](el);
490 } 454 }
491 }, 455 },