From 2c6339a9191033c937c2bac3e181c2bc380f4c48 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 12 Mar 2012 12:00:07 -0700 Subject: Fixed element mediator, PI, and eye-dropper to handle different borders sides and gradients. Signed-off-by: Nivesh Rajbhandari --- js/controllers/elements/element-controller.js | 32 ++++++++++++++++++--------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'js/controllers/elements/element-controller.js') diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index ec0335b4..9f00604f 100755 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js @@ -74,8 +74,9 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, //-------------------------------------------------------------------------------------------------------- // Routines to get/set color properties + // borderSide : "top", "right", "bottom", or "left" getColor: { - value: function(el, isFill) { + value: function(el, isFill, borderSide) { var colorObj, color, image; @@ -87,22 +88,29 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, { return el.elementModel.fill; } -// return this.application.ninja.stylesController.getElementStyle(el, "background-color"); //TODO: Once logic for color and gradient is established, this needs to be revised color = this.getProperty(el, "background-color"); image = this.getProperty(el, "background-image"); } else { - // TODO - Need to figure out which border side user wants - if(el.elementModel.stroke) + // Try getting border color from specific side first + if(borderSide) { - return el.elementModel.stroke; + color = this.getProperty(el, "border-" + borderSide + "-color"); + image = this.getProperty(el, "border-" + borderSide + "-image"); + } + + // If no color was found, look up the shared border color + if(!color && !image) + { + if(el.elementModel.stroke) + { + return el.elementModel.stroke; + } + color = this.getProperty(el, "border-color"); + image = this.getProperty(el, "border-image"); } - // TODO - Need to figure out which border side user wants -// return this.application.ninja.stylesController.getElementStyle(el, "border-color"); - color = this.getProperty(el, "border-color"); - image = this.getProperty(el, "border-image"); } if(color || image) { @@ -120,11 +128,15 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, { el.elementModel.fill = colorObj; } - else + else if(!borderSide) { // TODO - Need to update border style and width also el.elementModel.stroke = colorObj; } + else + { + // TODO - Should update specific border sides too + } return colorObj; } -- cgit v1.2.3 From e07ec7dd1a4b8df747f6af0d54fe95e3a237f0c8 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 14 Mar 2012 11:47:06 -0700 Subject: Removing the name attribute from the PI. Fixing the ID and Class attribute from the PI Signed-off-by: Valerio Virgillito --- js/controllers/elements/element-controller.js | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'js/controllers/elements/element-controller.js') diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index 9f00604f..70aba54e 100755 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js @@ -51,23 +51,6 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, setAttribute: { value: function(el, att, value) { - if(att === "id") { - if(value === "") { - el.setAttribute(att, value); - return; - } - - // Then check if this is a valid id by the following spec: http://www.w3.org/TR/REC-html40/types.html#h-6.2 - var regexID = /^([a-zA-Z])+([a-zA-Z0-9_\.\:\-])+/; - if(!regexID.test(value)) { - alert("Invalid ID"); - return; - } else if (this.application.ninja.currentDocument._document.getElementById(value) !== null) { - alert("The following ID: " + value + " is already in Use"); - } - - } - el.setAttribute(att, value); } }, -- cgit v1.2.3