From 8eac5582b72115969a9f915f4303535c22018033 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Wed, 2 May 2012 17:00:12 -0700 Subject: Material editor --- js/controllers/elements/shapes-controller.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/controllers/elements') diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index 8d7b74f0..acf3b63d 100755 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js @@ -166,10 +166,10 @@ exports.ShapesController = Montage.create(CanvasController, { } break; case "editStrokeMaterial": - NJevent("showMaterialPopup",{materialId : this.getProperty(el, "strokeMaterial")}); + NJevent("showMaterialPopup",{materialId : this.getProperty(el, "strokeMaterial"), useSelection: true, whichMaterial: 'stroke'}); break; case "editFillMaterial": - NJevent("showMaterialPopup",{materialId : this.getProperty(el, "fillMaterial")}); + NJevent("showMaterialPopup",{materialId : this.getProperty(el, "fillMaterial"), useSelection: true, whichMaterial: 'fill'}); break; case "animate": if(value) -- cgit v1.2.3 From 20c0d7c1b6e7544da2aee3ade08b73883cd458c1 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 3 May 2012 09:42:08 -0700 Subject: Updated hard-coded linear and radial gradients to use the color values in Linear/RadialGradientMaterials. Signed-off-by: Nivesh Rajbhandari --- js/controllers/elements/shapes-controller.js | 46 +++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 7 deletions(-) (limited to 'js/controllers/elements') diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index acf3b63d..b2a7107b 100755 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js @@ -142,7 +142,7 @@ exports.ShapesController = Montage.create(CanvasController, { if(m) { el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(m); - color = this.getMaterialColor(value); + color = this.getMaterialColor(m); if(color) { el.elementModel.shapeModel.GLGeomObj.setStrokeColor(color); @@ -156,7 +156,7 @@ exports.ShapesController = Montage.create(CanvasController, { if(m) { el.elementModel.shapeModel.GLGeomObj.setFillMaterial(m); - color = this.getMaterialColor(value); + color = this.getMaterialColor(m); if(color) { el.elementModel.shapeModel.GLGeomObj.setFillColor(color); @@ -750,14 +750,34 @@ exports.ShapesController = Montage.create(CanvasController, { value: function(m) { var css, - colorObj; - if(m === "LinearGradientMaterial") + colorObj, + c, + mName = m.getName(); + if(mName === "LinearGradientMaterial") { - css = "-webkit-gradient(linear, left top, right top, from(rgb(255, 0, 0)), color-stop(0.3, rgb(0, 255, 0)), color-stop(0.6, rgb(0, 0, 255)), to(rgb(0, 255, 255)))"; + css = "-webkit-gradient(linear, left top, right top, from("; + c = this.webGlColorToCss(m, 1); + css += c.rgb + ")"; + c = this.webGlColorToCss(m, 2); + css += ", color-stop(" + c.stop + ", " + c.rgb + ")"; + c = this.webGlColorToCss(m, 3); + css += ", color-stop(" + c.stop + ", " + c.rgb + ")"; + c = this.webGlColorToCss(m, 4); + css += ", to(" + c.rgb + "))"; +// console.log(css); } - else if(m === "RadialGradientMaterial") + else if(mName === "RadialGradientMaterial") { - css = "-webkit-radial-gradient(50% 50%, ellipse cover, rgb(255, 0, 0) 0%, rgb(0, 255, 0) 30%, rgb(0, 0, 255) 60%, rgb(0, 255, 255) 100%)"; + css = "-webkit-radial-gradient(50% 50%, ellipse cover, "; + c = this.webGlColorToCss(m, 1); + css += c.rgb + " " + c.stop*100 + "%"; + c = this.webGlColorToCss(m, 2); + css += c.rgb + " " + c.stop*100 + "%"; + c = this.webGlColorToCss(m, 3); + css += c.rgb + " " + c.stop*100 + "%"; + c = this.webGlColorToCss(m, 4); + css += c.rgb + " " + c.stop*100 + "%)"; +// console.log(css); } if(css) @@ -771,6 +791,18 @@ exports.ShapesController = Montage.create(CanvasController, { return null; } + }, + + webGlColorToCss: { + value: function(m, index) + { + var color, rgba, cStop; + color = m["getColor" + index](); + rgba = 'rgba(' + color[0]*255 + ',' + color[1]*255 + ',' + color[2]*255 + ',' + color[3] + ')'; + cStop = m["getColorStop" + index](); + + return {rgb:rgba, stop: cStop}; + } } }); -- cgit v1.2.3 From 5fcb96cae89007c684df3ce948831e2fcf9fd8b7 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Mon, 14 May 2012 10:00:52 -0700 Subject: Fixing merge issues --- js/controllers/elements/shapes-controller.js | 46 +++++----------------------- 1 file changed, 7 insertions(+), 39 deletions(-) (limited to 'js/controllers/elements') diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index 0d6defe2..da4e6d1b 100755 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js @@ -142,7 +142,7 @@ exports.ShapesController = Montage.create(CanvasController, { if(m) { el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(m); - color = this.getMaterialColor(m); + color = this.getMaterialColor(value); if(color) { el.elementModel.shapeModel.GLGeomObj.setStrokeColor(color); @@ -156,7 +156,7 @@ exports.ShapesController = Montage.create(CanvasController, { if(m) { el.elementModel.shapeModel.GLGeomObj.setFillMaterial(m); - color = this.getMaterialColor(m); + color = this.getMaterialColor(value); if(color) { el.elementModel.shapeModel.GLGeomObj.setFillColor(color); @@ -750,34 +750,14 @@ exports.ShapesController = Montage.create(CanvasController, { value: function(m) { var css, - colorObj, - c, - mName = m.getName(); - if(mName === "LinearGradientMaterial") + colorObj; + if(m === "LinearGradientMaterial") { - css = "-webkit-gradient(linear, left top, right top, from("; - c = this.webGlColorToCss(m, 1); - css += c.rgb + ")"; - c = this.webGlColorToCss(m, 2); - css += ", color-stop(" + c.stop + ", " + c.rgb + ")"; - c = this.webGlColorToCss(m, 3); - css += ", color-stop(" + c.stop + ", " + c.rgb + ")"; - c = this.webGlColorToCss(m, 4); - css += ", to(" + c.rgb + "))"; -// console.log(css); + css = "-webkit-gradient(linear, left top, right top, from(rgb(255, 0, 0)), color-stop(0.3, rgb(0, 255, 0)), color-stop(0.6, rgb(0, 0, 255)), to(rgb(0, 255, 255)))"; } - else if(mName === "RadialGradientMaterial") + else if(m === "RadialGradientMaterial") { - css = "-webkit-radial-gradient(50% 50%, ellipse cover, "; - c = this.webGlColorToCss(m, 1); - css += c.rgb + " " + c.stop*100 + "%"; - c = this.webGlColorToCss(m, 2); - css += c.rgb + " " + c.stop*100 + "%"; - c = this.webGlColorToCss(m, 3); - css += c.rgb + " " + c.stop*100 + "%"; - c = this.webGlColorToCss(m, 4); - css += c.rgb + " " + c.stop*100 + "%)"; -// console.log(css); + css = "-webkit-radial-gradient(50% 50%, ellipse cover, rgb(255, 0, 0) 0%, rgb(0, 255, 0) 30%, rgb(0, 0, 255) 60%, rgb(0, 255, 255) 100%)"; } if(css) @@ -791,18 +771,6 @@ exports.ShapesController = Montage.create(CanvasController, { return null; } - }, - - webGlColorToCss: { - value: function(m, index) - { - var color, rgba, cStop; - color = m["getColor" + index](); - rgba = 'rgba(' + color[0]*255 + ',' + color[1]*255 + ',' + color[2]*255 + ',' + color[3] + ')'; - cStop = m["getColorStop" + index](); - - return {rgb:rgba, stop: cStop}; - } } }); -- cgit v1.2.3