From 68f8788c80d7f8d7815aca65ffabaa40b9434705 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 14 Feb 2012 23:47:33 -0800 Subject: fixing the controller to handle all properties Signed-off-by: Valerio Virgillito --- js/controllers/elements/component-controller.js | 43 +++++++++++-------------- 1 file changed, 18 insertions(+), 25 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/elements/component-controller.js b/js/controllers/elements/component-controller.js index 33b9b79a..7fa62d1e 100644 --- a/js/controllers/elements/component-controller.js +++ b/js/controllers/elements/component-controller.js @@ -12,20 +12,15 @@ exports.ComponentController = Montage.create(ElementController, { getProperty: { value: function(el, prop) { switch(prop) { - case "label": - return this.application.ninja.currentDocument.getComponentFromElement(el).label; - break; - case "enabled": - return this.application.ninja.currentDocument.getComponentFromElement(el).enabled; - break; - case "disabled": - return this.application.ninja.currentDocument.getComponentFromElement(el).disabled; - break; - case "value": - return this.application.ninja.currentDocument.getComponentFromElement(el).value; - break; - default: + case "id": + case "class": + case "left": + case "top": + case "width": + case "height": return ElementController.getProperty(el, prop, true); + default: + return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; } } }, @@ -33,20 +28,18 @@ exports.ComponentController = Montage.create(ElementController, { setProperty: { value: function(el, p, value) { switch(p) { - case "label": - this.application.ninja.currentDocument.getComponentFromElement(el).label = value; - break; - case "enabled": - this.application.ninja.currentDocument.getComponentFromElement(el).enabled = value; - break; - case "disabled": - this.application.ninja.currentDocument.getComponentFromElement(el).disabled = value; - break; - case "value": - this.application.ninja.currentDocument.getComponentFromElement(el).value = value; + case "id": + case "class": + case "left": + case "top": + case "width": + case "height": + ElementController.setProperty(el, p, value); break; default: - ElementController.setProperty(el, p, value); + this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value; + break; + } } } -- cgit v1.2.3 From 747616980cad14f0b65fbcc7f497ed9680a39d29 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 15 Feb 2012 14:55:21 -0800 Subject: Adding more components pi Added rest of the components pi. Missing text-input and select Signed-off-by: Valerio Virgillito --- js/controllers/elements/component-controller.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'js/controllers') 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, { case "top": case "width": case "height": - return ElementController.getProperty(el, prop, true); + if(el.nodeName === "IMG" && (prop === "width" || prop === "height")) { + return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; + } else { + return ElementController.getProperty(el, prop, true); + } default: return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; } @@ -34,9 +38,15 @@ exports.ComponentController = Montage.create(ElementController, { case "top": case "width": case "height": - ElementController.setProperty(el, p, value); + if(el.nodeName === "IMG" && (p === "width" || p === "height")) { + this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value; + } else { + ElementController.setProperty(el, p, value); + } break; default: + if(p === "min" || p === "max") value = parseFloat(value); + this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value; break; -- cgit v1.2.3 From e0bead5a36ae987c558607b77745c4018caf59f8 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 16 Feb 2012 21:42:56 -0800 Subject: Adding a data-RDGE-id attribute to each canvas to save/load canvas data Signed-off-by: Valerio Virgillito --- js/controllers/elements/shapes-controller.js | 1 + 1 file changed, 1 insertion(+) (limited to 'js/controllers') 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, { break; case "useWebGl": var canvas = njModule.NJUtils.makeNJElement("canvas", "Canvas", "shape", el.className, true); + canvas.setAttribute("data-RDGE-id", njModule.NJUtils.generateRandom()); canvas.width = el.width; canvas.height = el.height; this.application.ninja.elementMediator.replaceElement(el, canvas); -- cgit v1.2.3