diff options
author | Valerio Virgillito | 2012-06-11 17:46:29 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-06-11 17:46:29 -0700 |
commit | b6c88f548c8d3756738e534418732710af733f03 (patch) | |
tree | d651ce2811019a3bccfd8be1326762cd2c601316 /js/mediators/element-mediator.js | |
parent | 91123fef348ec54d89005adbc151e816856a6a18 (diff) | |
parent | 6854a72504f57903bd5de003e377f2aefb02d0da (diff) | |
download | ninja-b6c88f548c8d3756738e534418732710af733f03.tar.gz |
Merge branch 'refs/heads/master' into montage-v10-integration
Conflicts:
js/io/system/ninjalibrary.json
js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/mediators/element-mediator.js')
-rwxr-xr-x | js/mediators/element-mediator.js | 35 |
1 files changed, 1 insertions, 34 deletions
diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index da8cbb76..40e94cca 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js | |||
@@ -29,16 +29,13 @@ 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) { | ||
33 | element.elementModel.props3D.init(element, false); | 32 | 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) { | ||
39 | elements.elementModel.props3D.init(elements, false); | 36 | elements.elementModel.props3D.init(elements, false); |
37 | |||
40 | } | 38 | } |
41 | } | ||
42 | 39 | ||
43 | if(this.addDelegate && typeof (this.addDelegate['onAddElements']) === "function") { | 40 | if(this.addDelegate && typeof (this.addDelegate['onAddElements']) === "function") { |
44 | this.addDelegate['onAddElements'].call(this.addDelegate, elements); | 41 | this.addDelegate['onAddElements'].call(this.addDelegate, elements); |
@@ -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 | }, |
@@ -450,18 +429,12 @@ exports.ElementMediator = Montage.create(Component, { | |||
450 | // Routines to get/set 3D properties | 429 | // Routines to get/set 3D properties |
451 | get3DProperty: { | 430 | get3DProperty: { |
452 | value: function(el, prop) { | 431 | value: function(el, prop) { |
453 | if(!el.elementModel) { | ||
454 | NJUtils.makeModelFromElement(el); | ||
455 | } | ||
456 | return el.elementModel.controller["get3DProperty"](el, prop); | 432 | return el.elementModel.controller["get3DProperty"](el, prop); |
457 | } | 433 | } |
458 | }, | 434 | }, |
459 | 435 | ||
460 | get3DProperties: { | 436 | get3DProperties: { |
461 | value: function(el) { | 437 | value: function(el) { |
462 | if(!el.elementModel) { | ||
463 | NJUtils.makeModelFromElement(el); | ||
464 | } | ||
465 | // var mat = this.getMatrix(el); | 438 | // var mat = this.getMatrix(el); |
466 | // var dist = this.getPerspectiveDist(el); | 439 | // var dist = this.getPerspectiveDist(el); |
467 | var mat = el.elementModel.controller["getMatrix"](el); | 440 | var mat = el.elementModel.controller["getMatrix"](el); |
@@ -472,18 +445,12 @@ exports.ElementMediator = Montage.create(Component, { | |||
472 | 445 | ||
473 | getMatrix: { | 446 | getMatrix: { |
474 | value: function(el) { | 447 | value: function(el) { |
475 | if(!el.elementModel) { | ||
476 | NJUtils.makeModelFromElement(el); | ||
477 | } | ||
478 | return el.elementModel.controller["getMatrix"](el); | 448 | return el.elementModel.controller["getMatrix"](el); |
479 | } | 449 | } |
480 | }, | 450 | }, |
481 | 451 | ||
482 | getPerspectiveDist: { | 452 | getPerspectiveDist: { |
483 | value: function(el) { | 453 | value: function(el) { |
484 | if(!el.elementModel) { | ||
485 | NJUtils.makeModelFromElement(el); | ||
486 | } | ||
487 | return el.elementModel.controller["getPerspectiveDist"](el); | 454 | return el.elementModel.controller["getPerspectiveDist"](el); |
488 | } | 455 | } |
489 | }, | 456 | }, |