diff options
author | Pushkar Joshi | 2012-02-24 12:08:49 -0800 |
---|---|---|
committer | Pushkar Joshi | 2012-02-24 12:08:49 -0800 |
commit | 03ca7a5ed13c25faaa9100bb666e062fd15335e6 (patch) | |
tree | c51112223ceb9121cd595a60335eb2795215590f /js/controllers/elements/component-controller.js | |
parent | fcb12cc09eb3cd3b42bd215877ba18f449275b75 (diff) | |
parent | 053fc63a2950c7a5ee4ebf98033b64d474a3c46e (diff) | |
download | ninja-03ca7a5ed13c25faaa9100bb666e062fd15335e6.tar.gz |
Merge branch 'pentool' into brushtool
Conflicts:
imports/codemirror/mode/scheme/scheme.js
js/tools/BrushTool.js
Diffstat (limited to 'js/controllers/elements/component-controller.js')
-rwxr-xr-x[-rw-r--r--] | js/controllers/elements/component-controller.js | 44 |
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 | ||
10 | exports.ComponentController = Montage.create(ElementController, { | 10 | exports.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 | }); |