From 2edf68e0de786cdc92d5f41548fd61e6c77a57ec Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 13 Feb 2012 09:56:40 -0800 Subject: Updated ink bottle tool to use new setColor routine in the mediator and controllers. Signed-off-by: Nivesh Rajbhandari --- js/controllers/elements/element-controller.js | 13 +++++++++++++ js/controllers/elements/shapes-controller.js | 8 ++++++++ 2 files changed, 21 insertions(+) (limited to 'js/controllers') diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index 65d26bdd..5eb75613 100644 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js @@ -115,6 +115,7 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, } else { + // TODO - Need to update border style and width also el.elementModel.stroke = colorObj; } @@ -159,10 +160,22 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, case 'gradient': this.setProperty(el, "border-image", color.color.css); this.setProperty(el, "border-color", "none"); + if(color.borderInfo) + { + this.setProperty(el, "border-width", color.borderInfo.borderWidth + + color.borderInfo.borderUnits); + this.setProperty(el, "border-style", color.borderInfo.borderStyle); + } break; default: this.setProperty(el, "border-image", "none"); this.setProperty(el, "border-color", color.color.css); + if(color.borderInfo) + { + this.setProperty(el, "border-width", color.borderInfo.borderWidth + + color.borderInfo.borderUnits); + this.setProperty(el, "border-style", color.borderInfo.borderStyle); + } } } el.elementModel.stroke = color; diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index 640119c4..42c2528f 100644 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js @@ -260,6 +260,14 @@ exports.ShapesController = Montage.create(CanvasController, { el.elementModel.shapeModel.GLGeomObj.setStrokeColor(webGl); this.setShapeProperty(el, "stroke", webGl); this.setShapeProperty(el, "border", color); + if(color.strokeInfo) + { + var strokeWidth = this.GetValueInPixels(color.strokeInfo.strokeSize, + color.strokeInfo.strokeUnits); + el.elementModel.shapeModel.GLGeomObj.setStrokeWidth(strokeWidth); + this.setShapeProperty(el, "strokeSize", color.strokeInfo.strokeSize + " " + + color.strokeInfo.strokeUnits); + } } el.elementModel.shapeModel.GLWorld.render(); } -- cgit v1.2.3 From c0ab12c07d18149e3704d3e5f66aee43c13b7fd0 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 13 Feb 2012 11:57:04 -0800 Subject: Working around inconsistent color object when getting/setting WebGL values. Signed-off-by: Nivesh Rajbhandari --- js/controllers/elements/shapes-controller.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'js/controllers') diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index 42c2528f..8953f155 100644 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js @@ -249,6 +249,10 @@ exports.ShapesController = Montage.create(CanvasController, { setColor: { value: function(el, color, isFill) { var webGl = color.webGlColor || color.color.webGlColor; + if(!webGl) + { + webGl = this.application.ninja.colorController.colorModel.colorToWebGl(color.color); + } if(isFill) { el.elementModel.shapeModel.GLGeomObj.setFillColor(webGl); -- cgit v1.2.3 From a69c929602e64f10fb3903b89a2ca9e9ed2c8dfb Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 22 Feb 2012 10:33:25 -0800 Subject: Fixing eyedropper tool to get color from image data. This required us to workaround having inconsistent color object. Signed-off-by: Nivesh Rajbhandari --- js/controllers/color-controller.js | 14 +++++++++++++- js/controllers/elements/image-controller.js | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/color-controller.js b/js/controllers/color-controller.js index e3b15f1c..a6e41dd3 100755 --- a/js/controllers/color-controller.js +++ b/js/controllers/color-controller.js @@ -322,7 +322,19 @@ exports.ColorController = Montage.create(Component, { //Simple solid color color = this.parseCssToColor(css); } - //Returning color object (or null if none) + // TODO - Hack for inconsistent color object -- some workflows set color.color and some color.value + if(color) + { + if(color.value && !color.color) + { + color.color = color.value; + } + else if(color.color && !color.value) + { + color.value = color.color; + } + } + //Returning color object (or null if none) return color; } }, diff --git a/js/controllers/elements/image-controller.js b/js/controllers/elements/image-controller.js index 5abce13e..25ca8da6 100755 --- a/js/controllers/elements/image-controller.js +++ b/js/controllers/elements/image-controller.js @@ -19,7 +19,7 @@ exports.ImageController = Montage.create(ElementController, { return el.getAttribute(prop); break; default: - return ElementController.getProperty(el, prop); + return ElementController.getProperty(el, prop, true); } } }, -- cgit v1.2.3 From eb8223a286e3703a0b7995f5472aaec8dcffd7f8 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 22 Feb 2012 11:35:35 -0800 Subject: Color chips expect a color object, not a css value. Signed-off-by: Nivesh Rajbhandari --- js/controllers/elements/stage-controller.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/elements/stage-controller.js b/js/controllers/elements/stage-controller.js index a8546662..f9adcda2 100755 --- a/js/controllers/elements/stage-controller.js +++ b/js/controllers/elements/stage-controller.js @@ -76,9 +76,9 @@ exports.StageController = Montage.create(ElementController, { value: function(el, p) { switch(p) { case "background" : - return el.elementModel.stageBackground.style.getProperty(p); + return this.application.ninja.colorController.getColorObjFromCss(el.elementModel.stageBackground.style.getProperty(p)); case "border": - return el.elementModel.stageView.style.getProperty(p); + return this.application.ninja.colorController.getColorObjFromCss(el.elementModel.stageView.style.getProperty(p)); case "height": return el.elementModel.stageDimension.style.getProperty(p); case "width": -- cgit v1.2.3 From dae612ccef06a18eb7cccc2fd9d0db13ec4ef5f9 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 22 Feb 2012 11:49:47 -0800 Subject: Do not use color object for stage's border since we don't allow users to modify the stage's border; we only need the border-width. Signed-off-by: Nivesh Rajbhandari --- js/controllers/elements/stage-controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/controllers') diff --git a/js/controllers/elements/stage-controller.js b/js/controllers/elements/stage-controller.js index f9adcda2..abad3736 100755 --- a/js/controllers/elements/stage-controller.js +++ b/js/controllers/elements/stage-controller.js @@ -78,7 +78,7 @@ exports.StageController = Montage.create(ElementController, { case "background" : return this.application.ninja.colorController.getColorObjFromCss(el.elementModel.stageBackground.style.getProperty(p)); case "border": - return this.application.ninja.colorController.getColorObjFromCss(el.elementModel.stageView.style.getProperty(p)); + return el.elementModel.stageView.style.getProperty(p); case "height": return el.elementModel.stageDimension.style.getProperty(p); case "width": -- cgit v1.2.3 From 79da052891a3d8cfb70489edb71619f27bfe3939 Mon Sep 17 00:00:00 2001 From: John Mayhew Date: Wed, 22 Feb 2012 13:45:28 -0800 Subject: Fix for bug that keeps Ninja from launching over HTTP. We need to wrap any extension specific code in an if (window.chrome.app.isInstalled) check. --- js/controllers/document-controller.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'js/controllers') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 7491ef9f..fa611de4 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -85,7 +85,9 @@ var DocumentController = exports.DocumentController = Montage.create(Component, handleAppLoaded: { value: function() { //Adding an intercept to resources loaded to ensure user assets load from cloud simulator - chrome.webRequest.onBeforeRequest.addListener(this.handleWebRequest.bind(this), {urls: [""]}, ["blocking"]); + if (window.chrome.app.isInstalled) { + chrome.webRequest.onBeforeRequest.addListener(this.handleWebRequest.bind(this), {urls: [""]}, ["blocking"]); + } } }, //////////////////////////////////////////////////////////////////// -- cgit v1.2.3 From 41b69af7c0be3dd5fe4f772668862696af8b917a Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 23 Feb 2012 15:07:28 -0800 Subject: Fixing app mode check. Signed-off-by: Valerio Virgillito --- js/controllers/document-controller.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index fa611de4..1c9d9d59 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -84,8 +84,13 @@ var DocumentController = exports.DocumentController = Montage.create(Component, // handleAppLoaded: { value: function() { - //Adding an intercept to resources loaded to ensure user assets load from cloud simulator - if (window.chrome.app.isInstalled) { + //Checking for app to be loaded through extension + var check; + if (chrome && chrome.app) { + check = chrome.app.getDetails(); + } + if (check !== null) { + //Adding an intercept to resources loaded to ensure user assets load from cloud simulator chrome.webRequest.onBeforeRequest.addListener(this.handleWebRequest.bind(this), {urls: [""]}, ["blocking"]); } } -- cgit v1.2.3