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-x[-rw-r--r--]js/controllers/elements/component-controller.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/js/controllers/elements/component-controller.js b/js/controllers/elements/component-controller.js
index 458e6b46..83450d0f 100644..100755
--- a/js/controllers/elements/component-controller.js
+++ b/js/controllers/elements/component-controller.js
@@ -9,4 +9,48 @@ var Montage = require("montage/core/core").Montage,
9 9
10exports.ComponentController = Montage.create(ElementController, { 10exports.ComponentController = Montage.create(ElementController, {
11 11
12 getProperty: {
13 value: function(el, prop) {
14 switch(prop) {
15 case "id":
16 case "class":
17 case "left":
18 case "top":
19 case "width":
20 case "height":
21 if(el.nodeName === "IMG" && (prop === "width" || prop === "height")) {
22 return this.application.ninja.currentDocument.getComponentFromElement(el)[prop];
23 } else {
24 return ElementController.getProperty(el, prop, true);
25 }
26 default:
27 return this.application.ninja.currentDocument.getComponentFromElement(el)[prop];
28 }
29 }
30 },
31
32 setProperty: {
33 value: function(el, p, value) {
34 switch(p) {
35 case "id":
36 case "class":
37 case "left":
38 case "top":
39 case "width":
40 case "height":
41 if(el.nodeName === "IMG" && (p === "width" || p === "height")) {
42 this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value;
43 } else {
44 ElementController.setProperty(el, p, value);
45 }
46 break;
47 default:
48 if(p === "min" || p === "max") value = parseFloat(value);
49
50 this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value;
51 break;
52
53 }
54 }
55 }
12}); 56});