aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-02-17 00:20:42 -0800
committerJose Antonio Marquez2012-02-17 00:20:42 -0800
commit7e9c50aaa9774f1c8840e19d831ed2e7bfd9f61f (patch)
tree0a51be74f0d5b1f6c740cd1a9c79e00624a0c0af /js/controllers/elements
parent9fe5d98bf469036c856e28d71ad4160d630b4af4 (diff)
parent18a42c37d080c03830c3f0a4156b81044e6309ee (diff)
downloadninja-7e9c50aaa9774f1c8840e19d831ed2e7bfd9f61f.tar.gz
Merge branch 'refs/heads/NinjaInternal' into Color
Diffstat (limited to 'js/controllers/elements')
-rwxr-xr-xjs/controllers/elements/component-controller.js53
-rwxr-xr-xjs/controllers/elements/shapes-controller.js1
2 files changed, 29 insertions, 25 deletions
diff --git a/js/controllers/elements/component-controller.js b/js/controllers/elements/component-controller.js
index 33b9b79a..83450d0f 100755
--- a/js/controllers/elements/component-controller.js
+++ b/js/controllers/elements/component-controller.js
@@ -12,20 +12,19 @@ exports.ComponentController = Montage.create(ElementController, {
12 getProperty: { 12 getProperty: {
13 value: function(el, prop) { 13 value: function(el, prop) {
14 switch(prop) { 14 switch(prop) {
15 case "label": 15 case "id":
16 return this.application.ninja.currentDocument.getComponentFromElement(el).label; 16 case "class":
17 break; 17 case "left":
18 case "enabled": 18 case "top":
19 return this.application.ninja.currentDocument.getComponentFromElement(el).enabled; 19 case "width":
20 break; 20 case "height":
21 case "disabled": 21 if(el.nodeName === "IMG" && (prop === "width" || prop === "height")) {
22 return this.application.ninja.currentDocument.getComponentFromElement(el).disabled; 22 return this.application.ninja.currentDocument.getComponentFromElement(el)[prop];
23 break; 23 } else {
24 case "value": 24 return ElementController.getProperty(el, prop, true);
25 return this.application.ninja.currentDocument.getComponentFromElement(el).value; 25 }
26 break;
27 default: 26 default:
28 return ElementController.getProperty(el, prop, true); 27 return this.application.ninja.currentDocument.getComponentFromElement(el)[prop];
29 } 28 }
30 } 29 }
31 }, 30 },
@@ -33,20 +32,24 @@ exports.ComponentController = Montage.create(ElementController, {
33 setProperty: { 32 setProperty: {
34 value: function(el, p, value) { 33 value: function(el, p, value) {
35 switch(p) { 34 switch(p) {
36 case "label": 35 case "id":
37 this.application.ninja.currentDocument.getComponentFromElement(el).label = value; 36 case "class":
38 break; 37 case "left":
39 case "enabled": 38 case "top":
40 this.application.ninja.currentDocument.getComponentFromElement(el).enabled = value; 39 case "width":
41 break; 40 case "height":
42 case "disabled": 41 if(el.nodeName === "IMG" && (p === "width" || p === "height")) {
43 this.application.ninja.currentDocument.getComponentFromElement(el).disabled = value; 42 this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value;
44 break; 43 } else {
45 case "value": 44 ElementController.setProperty(el, p, value);
46 this.application.ninja.currentDocument.getComponentFromElement(el).value = value; 45 }
47 break; 46 break;
48 default: 47 default:
49 ElementController.setProperty(el, p, value); 48 if(p === "min" || p === "max") value = parseFloat(value);
49
50 this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value;
51 break;
52
50 } 53 }
51 } 54 }
52 } 55 }
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index f69e6fc9..5ced8820 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -39,6 +39,7 @@ exports.ShapesController = Montage.create(CanvasController, {
39 break; 39 break;
40 case "useWebGl": 40 case "useWebGl":
41 var canvas = njModule.NJUtils.makeNJElement("canvas", "Canvas", "shape", el.className, true); 41 var canvas = njModule.NJUtils.makeNJElement("canvas", "Canvas", "shape", el.className, true);
42 canvas.setAttribute("data-RDGE-id", njModule.NJUtils.generateRandom());
42 canvas.width = el.width; 43 canvas.width = el.width;
43 canvas.height = el.height; 44 canvas.height = el.height;
44 this.application.ninja.elementMediator.replaceElement(el, canvas); 45 this.application.ninja.elementMediator.replaceElement(el, canvas);