aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements
diff options
context:
space:
mode:
Diffstat (limited to 'js/controllers/elements')
-rwxr-xr-xjs/controllers/elements/body-controller.js9
-rwxr-xr-xjs/controllers/elements/controller-factory.js4
-rwxr-xr-xjs/controllers/elements/element-controller.js24
-rwxr-xr-xjs/controllers/elements/element-controller.js.orig393
-rwxr-xr-xjs/controllers/elements/shapes-controller.js2
5 files changed, 413 insertions, 19 deletions
diff --git a/js/controllers/elements/body-controller.js b/js/controllers/elements/body-controller.js
index 7a3a66f5..0dc11b82 100755
--- a/js/controllers/elements/body-controller.js
+++ b/js/controllers/elements/body-controller.js
@@ -30,7 +30,8 @@ exports.BodyController = Montage.create(ElementController, {
30 value: function(el, p) { 30 value: function(el, p) {
31 switch(p) { 31 switch(p) {
32 case "background" : 32 case "background" :
33 return this.application.ninja.colorController.getColorObjFromCss(this.application.ninja.stylesController.getElementStyle(el, "background-color", false, true)); 33 case "background-color":
34 return this.application.ninja.colorController.getColorObjFromCss(this.application.ninja.stylesController.getElementStyle(el, "background-color"));
34 case "border": 35 case "border":
35 return 0; 36 return 0;
36 case "height": 37 case "height":
@@ -47,8 +48,8 @@ exports.BodyController = Montage.create(ElementController, {
47 setProperty: { 48 setProperty: {
48 value: function(el, p, value) { 49 value: function(el, p, value) {
49 switch(p) { 50 switch(p) {
50 case "body-background":
51 case "background": 51 case "background":
52 case "background-color":
52 this.application.ninja.stylesController.setElementStyle(el, "background-color", value); 53 this.application.ninja.stylesController.setElementStyle(el, "background-color", value);
53 break; 54 break;
54 case "overflow": 55 case "overflow":
@@ -71,7 +72,7 @@ exports.BodyController = Montage.create(ElementController, {
71 72
72 getPerspectiveDist: { 73 getPerspectiveDist: {
73 value: function(el) { 74 value: function(el) {
74 if(el.elementModel && el.elementModel.props3D && el.elementModel.props3D.perspectiveDist) { 75 if(el.elementModel.props3D && el.elementModel.props3D.perspectiveDist) {
75 return el.elementModel.props3D.perspectiveDist; 76 return el.elementModel.props3D.perspectiveDist;
76 } else { 77 } else {
77 var dist = this.application.ninja.stylesController.getPerspectiveDistFromElement(el, true); 78 var dist = this.application.ninja.stylesController.getPerspectiveDistFromElement(el, true);
@@ -83,7 +84,7 @@ exports.BodyController = Montage.create(ElementController, {
83 84
84 getMatrix: { 85 getMatrix: {
85 value: function(el) { 86 value: function(el) {
86 if(el.elementModel && el.elementModel.props3D && el.elementModel.props3D.matrix3d) 87 if(el.elementModel.props3D && el.elementModel.props3D.matrix3d)
87 { 88 {
88 return el.elementModel.props3D.matrix3d.slice(0); 89 return el.elementModel.props3D.matrix3d.slice(0);
89 } 90 }
diff --git a/js/controllers/elements/controller-factory.js b/js/controllers/elements/controller-factory.js
index 3ac3fe14..2d2a5cd1 100755
--- a/js/controllers/elements/controller-factory.js
+++ b/js/controllers/elements/controller-factory.js
@@ -8,7 +8,6 @@ var Montage = require("montage/core/core").Montage;
8 8
9var BodyController = require("js/controllers/elements/body-controller").BodyController, 9var BodyController = require("js/controllers/elements/body-controller").BodyController,
10 BlockController = require("js/controllers/elements/block-controller").BlockController, 10 BlockController = require("js/controllers/elements/block-controller").BlockController,
11 StageController = require("js/controllers/elements/stage-controller").StageController,
12 ShapesController = require("js/controllers/elements/shapes-controller").ShapesController, 11 ShapesController = require("js/controllers/elements/shapes-controller").ShapesController,
13 ImageController = require("js/controllers/elements/image-controller").ImageController, 12 ImageController = require("js/controllers/elements/image-controller").ImageController,
14 VideoController = require("js/controllers/elements/video-controller").VideoController, 13 VideoController = require("js/controllers/elements/video-controller").VideoController,
@@ -27,7 +26,8 @@ exports.ControllerFactory = Montage.create(Montage, {
27 if(value.indexOf("block") !== -1) { 26 if(value.indexOf("block") !== -1) {
28 return BlockController; 27 return BlockController;
29 } else if(value.indexOf("stage") !== -1) { 28 } else if(value.indexOf("stage") !== -1) {
30 return StageController; 29// return StageController;
30 alert("Calling the stage controller. Should not be calling this object");
31 } else if(value.indexOf("body") !== -1) { 31 } else if(value.indexOf("body") !== -1) {
32 return BodyController; 32 return BodyController;
33 } else if(value.indexOf("shape") !== -1) { 33 } else if(value.indexOf("shape") !== -1) {
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js
index 308e598b..3d71c52d 100755
--- a/js/controllers/elements/element-controller.js
+++ b/js/controllers/elements/element-controller.js
@@ -57,7 +57,7 @@ exports.ElementController = Montage.create(Component, {
57 // Remove the element from the DOM and clear the GLWord. 57 // Remove the element from the DOM and clear the GLWord.
58 removeElement: { 58 removeElement: {
59 value: function(el) { 59 value: function(el) {
60 if(el.elementModel && el.elementModel.shapeModel && el.elementModel.shapeModel.GLWorld) { 60 if(el.elementModel.shapeModel && el.elementModel.shapeModel.GLWorld) {
61 el.elementModel.shapeModel.GLWorld.clearTree(); 61 el.elementModel.shapeModel.GLWorld.clearTree();
62 } 62 }
63 el.parentNode.removeChild(el); 63 el.parentNode.removeChild(el);
@@ -103,24 +103,24 @@ exports.ElementController = Montage.create(Component, {
103 103
104 // Return cached value if one exists 104 // Return cached value if one exists
105 if(isFill) { 105 if(isFill) {
106 if(el.elementModel.fill) { 106// if(el.elementModel.fill) {
107 return el.elementModel.fill; 107// return el.elementModel.fill;
108 } 108// }
109 //TODO: Once logic for color and gradient is established, this needs to be revised 109 //TODO: Once logic for color and gradient is established, this needs to be revised
110 color = this.getProperty(el, "background-color"); 110 color = this.getProperty(el, "background-color");
111 image = this.getProperty(el, "background-image"); 111 image = this.getProperty(el, "background-image");
112 } else { 112 } else {
113 // Try getting border color from specific side first 113 // Try getting border color from specific side first
114 if(borderSide) { 114 if(borderSide) {
115 color = this.getProperty(el, "border-" + borderSide + "-color"); 115 color = this.getProperty(el, "border-" + borderSide + "-color",true);
116 image = this.getProperty(el, "border-" + borderSide + "-image"); 116 image = this.getProperty(el, "border-" + borderSide + "-image");
117 } 117 }
118 118
119 // If no color was found, look up the shared border color 119 // If no color was found, look up the shared border color
120 if(!color && !image) { 120 if(!color && !image) {
121 if(el.elementModel.stroke) { 121// if(el.elementModel.stroke) {
122 return el.elementModel.stroke; 122// return el.elementModel.stroke;
123 } 123// }
124 124
125 color = this.getProperty(el, "border-color"); 125 color = this.getProperty(el, "border-color");
126 image = this.getProperty(el, "border-image"); 126 image = this.getProperty(el, "border-image");
@@ -152,7 +152,7 @@ exports.ElementController = Montage.create(Component, {
152 }, 152 },
153 153
154 setColor: { 154 setColor: {
155 value: function(el, color, isFill) { 155 value: function(el, color, isFill,borderSide) {
156 var mode = color.mode; 156 var mode = color.mode;
157 157
158 if(isFill) { 158 if(isFill) {
@@ -297,7 +297,7 @@ exports.ElementController = Montage.create(Component, {
297 // Routines to get/set 3D properties 297 // Routines to get/set 3D properties
298 get3DProperty: { 298 get3DProperty: {
299 value: function(el, prop) { 299 value: function(el, prop) {
300 if(el.elementModel && el.elementModel.props3D) { 300 if(el.elementModel.props3D) {
301 return el.elementModel.props3D[prop]; 301 return el.elementModel.props3D[prop];
302 } 302 }
303 } 303 }
@@ -305,7 +305,7 @@ exports.ElementController = Montage.create(Component, {
305 305
306 getMatrix: { 306 getMatrix: {
307 value: function(el) { 307 value: function(el) {
308 if(el.elementModel && el.elementModel.props3D && el.elementModel.props3D.matrix3d) { 308 if(el.elementModel.props3D && el.elementModel.props3D.matrix3d) {
309 return el.elementModel.props3D.matrix3d.slice(0); 309 return el.elementModel.props3D.matrix3d.slice(0);
310 } else { 310 } else {
311 var mat; 311 var mat;
@@ -325,7 +325,7 @@ exports.ElementController = Montage.create(Component, {
325 325
326 getPerspectiveDist: { 326 getPerspectiveDist: {
327 value: function(el) { 327 value: function(el) {
328 if(el.elementModel && el.elementModel.props3D && el.elementModel.props3D.perspectiveDist) { 328 if(el.elementModel.props3D && el.elementModel.props3D.perspectiveDist) {
329 return el.elementModel.props3D.perspectiveDist; 329 return el.elementModel.props3D.perspectiveDist;
330 } else { 330 } else {
331 var dist = this.application.ninja.stylesController.getPerspectiveDistFromElement(el, false); 331 var dist = this.application.ninja.stylesController.getPerspectiveDistFromElement(el, false);
diff --git a/js/controllers/elements/element-controller.js.orig b/js/controllers/elements/element-controller.js.orig
new file mode 100755
index 00000000..bf631d61
--- /dev/null
+++ b/js/controllers/elements/element-controller.js.orig
@@ -0,0 +1,393 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */
6
7var Montage = require("montage/core/core").Montage,
8 Component = require("montage/ui/component").Component,
9 njModule = require("js/lib/NJUtils");
10
11exports.ElementController = Montage.create(Component, {
12
13 addElement: {
14 value: function(el, styles) {
15
16 if (el.getAttribute) el.setAttribute('data-ninja-node', 'true');
17
18 // Updated to use new methods in TimelinePanel. JR.
19 var insertionIndex = this.application.ninja.timeline.getInsertionIndex();
20 if (insertionIndex === false) {
21 this.application.ninja.currentSelectedContainer.appendChild(el);
22 } else {
23 if (insertionIndex === 0) {
24 this.application.ninja.currentSelectedContainer.appendChild(el);
25 } else {
26 var element = this.application.ninja.timeline.arrLayers[insertionIndex].layerData.stageElement;
27 element.parentNode.insertBefore(el, element.nextSibling);
28 }
29 }
30
31 if(styles) {
32 this.application.ninja.stylesController.setElementStyles(el, styles);