aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements
diff options
context:
space:
mode:
authorAnanya Sen2012-02-17 14:26:56 -0800
committerAnanya Sen2012-02-17 14:26:56 -0800
commit2980816130a44cd478b2a9d6606e021efbcebd4a (patch)
tree762d98ba8852b858c03760f4b9bef294fae6486c /js/controllers/elements
parent96178309ddcdb54c0c451b69ea6fb8cdf76fcf62 (diff)
parenta42c536c2b3209afc058eabd31167bd0aa6f71c8 (diff)
downloadninja-2980816130a44cd478b2a9d6606e021efbcebd4a.tar.gz
Merge branch 'refs/heads/FileIO-jose' into FileIO
Conflicts: css/ninja.css js/controllers/document-controller.js Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/controllers/elements')
-rwxr-xr-xjs/controllers/elements/component-controller.js44
-rwxr-xr-xjs/controllers/elements/shapes-controller.js1
2 files changed, 45 insertions, 0 deletions
diff --git a/js/controllers/elements/component-controller.js b/js/controllers/elements/component-controller.js
index 458e6b46..83450d0f 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});
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index 640119c4..15a18a51 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -59,6 +59,7 @@ exports.ShapesController = Montage.create(CanvasController, {
59 break; 59 break;
60 case "useWebGl": 60 case "useWebGl":
61 var canvas = njModule.NJUtils.makeNJElement("canvas", "Canvas", "shape", el.className, true); 61 var canvas = njModule.NJUtils.makeNJElement("canvas", "Canvas", "shape", el.className, true);
62 canvas.setAttribute("data-RDGE-id", njModule.NJUtils.generateRandom());
62 canvas.width = el.width; 63 canvas.width = el.width;
63 canvas.height = el.height; 64 canvas.height = el.height;
64 this.application.ninja.elementMediator.replaceElement(el, canvas); 65 this.application.ninja.elementMediator.replaceElement(el, canvas);