diff options
Diffstat (limited to 'js/controllers/elements/component-controller.js')
-rwxr-xr-x | js/controllers/elements/component-controller.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/js/controllers/elements/component-controller.js b/js/controllers/elements/component-controller.js index 83450d0f..d902e4a1 100755 --- a/js/controllers/elements/component-controller.js +++ b/js/controllers/elements/component-controller.js | |||
@@ -11,43 +11,48 @@ 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 | case "-webkit-transform-style": | ||
17 | case "left": | 20 | case "left": |
18 | case "top": | 21 | case "top": |
19 | case "width": | 22 | case "width": |
20 | case "height": | 23 | case "height": |
21 | if(el.nodeName === "IMG" && (prop === "width" || prop === "height")) { | 24 | if(el.nodeName === "IMG" && (prop === "width" || prop === "height")) { |
22 | return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; | 25 | return component[prop]; |
23 | } else { | 26 | } else { |
24 | return ElementController.getProperty(el, prop, true); | 27 | return ElementController.getProperty(el, prop, true); |
25 | } | 28 | } |
26 | default: | 29 | default: |
27 | return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; | 30 | return component[prop]; |
28 | } | 31 | } |
29 | } | 32 | } |
30 | }, | 33 | }, |
31 | 34 | ||
32 | setProperty: { | 35 | setProperty: { |
33 | value: function(el, p, value) { | 36 | value: function(el, p, value) { |
37 | var component = el.controller || this.application.ninja.currentDocument.getComponentFromElement(el); | ||
38 | |||
34 | switch(p) { | 39 | switch(p) { |
35 | case "id": | 40 | case "id": |
36 | case "class": | 41 | case "class": |
42 | case "-webkit-transform-style": | ||
37 | case "left": | 43 | case "left": |
38 | case "top": | 44 | case "top": |
39 | case "width": | 45 | case "width": |
40 | case "height": | 46 | case "height": |
41 | if(el.nodeName === "IMG" && (p === "width" || p === "height")) { | 47 | if(el.nodeName === "IMG" && (p === "width" || p === "height")) { |
42 | this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value; | 48 | component[p] = value; |
43 | } else { | 49 | } else { |
44 | ElementController.setProperty(el, p, value); | 50 | ElementController.setProperty(el, p, value); |
45 | } | 51 | } |
46 | break; | 52 | break; |
47 | default: | 53 | default: |
48 | if(p === "min" || p === "max") value = parseFloat(value); | 54 | if(p === "min" || p === "max") value = parseFloat(value); |
49 | 55 | component[p] = value; | |
50 | this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value; | ||
51 | break; | 56 | break; |
52 | 57 | ||
53 | } | 58 | } |