aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements/component-controller.js
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-03-27 09:32:53 -0700
committerNivesh Rajbhandari2012-03-27 09:32:53 -0700
commit406bbfc63f8ed42d7da105dbd068a49ff8fb5f09 (patch)
tree3a8b45f4802f002269ff1bcf596f94cee4679a07 /js/controllers/elements/component-controller.js
parentbda9f8f5829c943486f8850e68c991e83f8fb8c8 (diff)
parent309dde5a8c4599cef6a1052c1ff9ee1ad8ec5858 (diff)
downloadninja-406bbfc63f8ed42d7da105dbd068a49ff8fb5f09.tar.gz
Merge branch 'refs/heads/ninja-internal' into WebGLMaterials
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/controllers/elements/component-controller.js')
-rwxr-xr-xjs/controllers/elements/component-controller.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/js/controllers/elements/component-controller.js b/js/controllers/elements/component-controller.js
index fbe9a995..d902e4a1 100755
--- a/js/controllers/elements/component-controller.js
+++ b/js/controllers/elements/component-controller.js
@@ -11,6 +11,8 @@ exports.ComponentController = Montage.create(ElementController, {
11 11
12 getProperty: { 12 getProperty: {
13 value: function(el, prop) { 13 value: function(el, prop) {
14 var component = el.controller || this.application.ninja.currentDocument.getComponentFromElement(el);
15
14 switch(prop) { 16 switch(prop) {
15 case "id": 17 case "id":
16 case "class": 18 case "class":
@@ -20,18 +22,20 @@ exports.ComponentController = Montage.create(ElementController, {
20 case "width": 22 case "width":
21 case "height": 23 case "height":
22 if(el.nodeName === "IMG" && (prop === "width" || prop === "height")) { 24 if(el.nodeName === "IMG" && (prop === "width" || prop === "height")) {
23 return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; 25 return component[prop];
24 } else { 26 } else {
25 return ElementController.getProperty(el, prop, true); 27 return ElementController.getProperty(el, prop, true);
26 } 28 }
27 default: 29 default:
28 return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; 30 return component[prop];
29 } 31 }
30 } 32 }
31 }, 33 },
32 34
33 setProperty: { 35 setProperty: {
34 value: function(el, p, value) { 36 value: function(el, p, value) {
37 var component = el.controller || this.application.ninja.currentDocument.getComponentFromElement(el);
38
35 switch(p) { 39 switch(p) {
36 case "id": 40 case "id":
37 case "class": 41 case "class":
@@ -41,15 +45,14 @@ exports.ComponentController = Montage.create(ElementController, {
41 case "width": 45 case "width":
42 case "height": 46 case "height":
43 if(el.nodeName === "IMG" && (p === "width" || p === "height")) { 47 if(el.nodeName === "IMG" && (p === "width" || p === "height")) {
44 this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value; 48 component[p] = value;
45 } else { 49 } else {
46 ElementController.setProperty(el, p, value); 50 ElementController.setProperty(el, p, value);
47 } 51 }
48 break; 52 break;
49 default: 53 default:
50 if(p === "min" || p === "max") value = parseFloat(value); 54 if(p === "min" || p === "max") value = parseFloat(value);
51 55 component[p] = value;
52 this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value;
53 break; 56 break;
54 57
55 } 58 }