diff options
author | Pushkar Joshi | 2012-03-27 09:10:58 -0700 |
---|---|---|
committer | Pushkar Joshi | 2012-03-27 09:10:58 -0700 |
commit | 0c26aff9c19c2b39fca06fa6b3bc76b672204065 (patch) | |
tree | e778f2b9d5d525aa364360d5996536a0a06379bd /js/controllers/elements/component-controller.js | |
parent | 753244b4713243ab19ca246be674f0b45fb85b72 (diff) | |
parent | 309dde5a8c4599cef6a1052c1ff9ee1ad8ec5858 (diff) | |
download | ninja-0c26aff9c19c2b39fca06fa6b3bc76b672204065.tar.gz |
Merge branch 'master' into brushtool
Conflicts:
js/controllers/elements/shapes-controller.js
Diffstat (limited to 'js/controllers/elements/component-controller.js')
-rwxr-xr-x | js/controllers/elements/component-controller.js | 13 |
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 | } |