From 44d75ed17d56055ed9dbb8f91867bbdbc68924fa Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Sun, 18 Mar 2012 22:21:14 -0700 Subject: fixing the selection of components. Temporary workaround for now. Signed-off-by: Valerio Virgillito --- js/controllers/elements/component-controller.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'js/controllers/elements') diff --git a/js/controllers/elements/component-controller.js b/js/controllers/elements/component-controller.js index 83450d0f..260ee8a0 100755 --- a/js/controllers/elements/component-controller.js +++ b/js/controllers/elements/component-controller.js @@ -11,6 +11,8 @@ exports.ComponentController = Montage.create(ElementController, { getProperty: { value: function(el, prop) { + var component = el.controller || this.application.ninja.currentDocument.getComponentFromElement(el); + switch(prop) { case "id": case "class": @@ -19,18 +21,20 @@ exports.ComponentController = Montage.create(ElementController, { case "width": case "height": if(el.nodeName === "IMG" && (prop === "width" || prop === "height")) { - return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; + return component[prop]; } else { return ElementController.getProperty(el, prop, true); } default: - return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; + return component[prop]; } } }, setProperty: { value: function(el, p, value) { + var component = el.controller || this.application.ninja.currentDocument.getComponentFromElement(el); + switch(p) { case "id": case "class": @@ -39,15 +43,14 @@ exports.ComponentController = Montage.create(ElementController, { case "width": case "height": if(el.nodeName === "IMG" && (p === "width" || p === "height")) { - this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value; + component[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; + component[p] = value; break; } -- cgit v1.2.3