aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements/component-controller.js
diff options
context:
space:
mode:
authorEric Guzman2012-04-02 15:36:08 -0700
committerEric Guzman2012-04-02 15:36:08 -0700
commit0241bf331b7e06e206a54be441edf2f4c7261f63 (patch)
treeb7e2f9cad73eed4fc616cf1841cd0be02bd955d4 /js/controllers/elements/component-controller.js
parentdde5b5054f93db493e5d4d502e677f5781334b08 (diff)
parentc6de22bf42be90b403491b5f87b1818d9020310c (diff)
downloadninja-0241bf331b7e06e206a54be441edf2f4c7261f63.tar.gz
Merge branch 'refs/heads/master' into CSSPanelUpdates
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 83450d0f..260ee8a0 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":
@@ -19,18 +21,20 @@ exports.ComponentController = Montage.create(ElementController, {
19 case "width": 21 case "width":
20 case "height": 22 case "height":
21 if(el.nodeName === "IMG" && (prop === "width" || prop === "height")) { 23 if(el.nodeName === "IMG" && (prop === "width" || prop === "height")) {
22 return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; 24 return component[prop];
23 } else { 25 } else {
24 return ElementController.getProperty(el, prop, true); 26 return ElementController.getProperty(el, prop, true);
25 } 27 }
26 default: 28 default:
27 return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; 29 return component[prop];
28 } 30 }
29 } 31 }
30 }, 32 },
31 33
32 setProperty: { 34 setProperty: {
33 value: function(el, p, value) { 35 value: function(el, p, value) {
36 var component = el.controller || this.application.ninja.currentDocument.getComponentFromElement(el);
37
34 switch(p) { 38 switch(p) {
35 case "id": 39 case "id":
36 case "class": 40 case "class":
@@ -39,15 +43,14 @@ exports.ComponentController = Montage.create(ElementController, {
39 case "width": 43 case "width":
40 case "height": 44 case "height":
41 if(el.nodeName === "IMG" && (p === "width" || p === "height")) { 45 if(el.nodeName === "IMG" && (p === "width" || p === "height")) {
42 this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value; 46 component[p] = value;
43 } else { 47 } else {
44 ElementController.setProperty(el, p, value); 48 ElementController.setProperty(el, p, value);
45 } 49 }
46 break; 50 break;
47 default: 51 default:
48 if(p === "min" || p === "max") value = parseFloat(value); 52 if(p === "min" || p === "max") value = parseFloat(value);
49 53 component[p] = value;
50 this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value;
51 break; 54 break;
52 55
53 } 56 }