aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorValerio Virgillito2012-02-15 14:55:21 -0800
committerValerio Virgillito2012-02-15 14:55:21 -0800
commit747616980cad14f0b65fbcc7f497ed9680a39d29 (patch)
treed04fe7a572fd6a0a17a6c631988989e9cd9e43a6 /js
parentd1bc0d3e8b3ab3341105c3e29dd2ca11a20d8931 (diff)
downloadninja-747616980cad14f0b65fbcc7f497ed9680a39d29.tar.gz
Adding more components pi
Added rest of the components pi. Missing text-input and select Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js')
-rw-r--r--js/controllers/elements/component-controller.js14
-rw-r--r--js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js8
2 files changed, 18 insertions, 4 deletions
diff --git a/js/controllers/elements/component-controller.js b/js/controllers/elements/component-controller.js
index 7fa62d1e..83450d0f 100644
--- a/js/controllers/elements/component-controller.js
+++ b/js/controllers/elements/component-controller.js
@@ -18,7 +18,11 @@ exports.ComponentController = Montage.create(ElementController, {
18 case "top": 18 case "top":
19 case "width": 19 case "width":
20 case "height": 20 case "height":
21 return ElementController.getProperty(el, prop, true); 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 }
22 default: 26 default:
23 return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; 27 return this.application.ninja.currentDocument.getComponentFromElement(el)[prop];
24 } 28 }
@@ -34,9 +38,15 @@ exports.ComponentController = Montage.create(ElementController, {
34 case "top": 38 case "top":
35 case "width": 39 case "width":
36 case "height": 40 case "height":
37 ElementController.setProperty(el, p, value); 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 }
38 break; 46 break;
39 default: 47 default:
48 if(p === "min" || p === "max") value = parseFloat(value);
49
40 this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value; 50 this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value;
41 break; 51 break;
42 52
diff --git a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
index 987cd6b5..bcb14013 100644
--- a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
+++ b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
@@ -195,6 +195,8 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component
195 return "checkbox"; 195 return "checkbox";
196 case "select": 196 case "select":
197 return "dropdown"; 197 return "dropdown";
198 case "number":
199 return "hottext";
198 default: 200 default:
199 alert("Conversion not implemented for ", type); 201 alert("Conversion not implemented for ", type);
200 } 202 }
@@ -287,7 +289,9 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component
287 break; 289 break;
288 case "imageComponent": 290 case "imageComponent":
289 el = NJUtils.makeNJElement("image", "Image", "component"); 291 el = NJUtils.makeNJElement("image", "Image", "component");
290 el.elementModel.pi = "ImageComponentPi"; 292 el.elementModel.pi = "ImagePi";
293 el.setAttribute("width", 200);
294 el.setAttribute("height", 200);
291 break; 295 break;
292 case "numberInput": 296 case "numberInput":
293 el = NJUtils.makeNJElement("input", "Number Input", "component"); 297 el = NJUtils.makeNJElement("input", "Number Input", "component");
@@ -315,7 +319,7 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component
315 break; 319 break;
316 case "textarea": 320 case "textarea":
317 el = NJUtils.makeNJElement("textarea", "TextArea", "component"); 321 el = NJUtils.makeNJElement("textarea", "TextArea", "component");
318 el.elementModel.pi = "TextArea"; 322 el.elementModel.pi = "TextAreaPi";
319 break; 323 break;
320 case "toggleButton": 324 case "toggleButton":
321 el = NJUtils.makeNJElement("button", "Toggle Button", "component"); 325 el = NJUtils.makeNJElement("button", "Toggle Button", "component");