aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements/component-controller.js
diff options
context:
space:
mode:
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 }