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') 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') 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') 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 From fbd9d2492aeaef392ad59792825b8757d6c363fc Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Fri, 15 Jun 2012 15:14:34 -0700 Subject: Fixing apply 'no color' This should fix canvas and standard DOM elements including the root (body or template wrapper). --- js/controllers/color-controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/controllers') diff --git a/js/controllers/color-controller.js b/js/controllers/color-controller.js index d4737aad..3edaff86 100755 --- a/js/controllers/color-controller.js +++ b/js/controllers/color-controller.js @@ -198,7 +198,7 @@ exports.ColorController = Montage.create(Component, { enumerable: true, value: function (e) { // - var actionEvent, color, input = e._event.input, panelMode, mode = e._event.mode; + var color, input = e._event.input, panelMode, mode = e._event.mode; if (this.colorView) { panelMode = this.colorView.panelMode; } -- cgit v1.2.3 From d5aec31ee519069ff6120e5d5685828750501e67 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Sat, 16 Jun 2012 19:04:13 -0700 Subject: More cleaning up Controller will need a review and refactoring. --- js/controllers/color-controller.js | 48 +++++++------------------------------- 1 file changed, 8 insertions(+), 40 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/color-controller.js b/js/controllers/color-controller.js index 3edaff86..3165988d 100755 --- a/js/controllers/color-controller.js +++ b/js/controllers/color-controller.js @@ -19,13 +19,11 @@ exports.ColorController = Montage.create(Component, { //////////////////////////////////////////////////////////////////// // hasTemplate: { - enumerable: true, value: false }, //////////////////////////////////////////////////////////////////// // deserializedFromTemplate: { - enumerable: true, value: function () { //Setting up colorManager in other classes this.colorPanelBase.colorManager = this.colorModel; @@ -38,60 +36,47 @@ exports.ColorController = Montage.create(Component, { //////////////////////////////////////////////////////////////////// // colorModel: { - enumerable: true, value: ColorModel }, //////////////////////////////////////////////////////////////////// // colorPanelBase: { - enumerable: true, value: ColorPanelBase }, //////////////////////////////////////////////////////////////////// // colorPopupManager: { - enumerable: true, value: ColorPopupManager }, //////////////////////////////////////////////////////////////////// // colorButtonManager: { - enumerable: true, value: ColorPopupManager }, //////////////////////////////////////////////////////////////////// // colorView: { - enumerable: true, value: null }, //////////////////////////////////////////////////////////////////// // colorToolbar: { - enumerable: true, value: null }, //////////////////////////////////////////////////////////////////// // _popupTab: { - enumerable: false, value: 'wheel' }, //////////////////////////////////////////////////////////////////// // popupTab: { - enumerable: true, - get: function() { - return this._popupTab; - }, - set: function(value) { - this._popupTab = value.toLowerCase(); - } + get: function() {return this._popupTab;}, + set: function(value) {this._popupTab = value.toLowerCase();} }, //////////////////////////////////////////////////////////////////// // addButton: { - enumerable: true, value: function (type, button) { if (this.colorView) { this.colorView.addButton(type, button); @@ -107,7 +92,6 @@ exports.ColorController = Montage.create(Component, { //////////////////////////////////////////////////////////////////// // removeButton: { - enumerable: true, value: function (type, button) { if (this.colorView) { this.colorView.removeButton(type, button); @@ -123,41 +107,28 @@ exports.ColorController = Montage.create(Component, { //////////////////////////////////////////////////////////////////// // _fill: { - enumerable: false, value: null }, //////////////////////////////////////////////////////////////////// // fill: { - enumerable: true, - get: function() { - return this._fill; - }, - set: function(value) { - this._fill = value; - } + get: function() {return this._fill;}, + set: function(value) {this._fill = value;} }, //////////////////////////////////////////////////////////////////// // _stroke: { - enumerable: false, value: null }, //////////////////////////////////////////////////////////////////// // stroke: { - enumerable: true, - get: function() { - return this._stroke; - }, - set: function(value) { - this._stroke = value; - } + get: function() {return this._stroke;}, + set: function(value) {this._stroke = value;} }, //////////////////////////////////////////////////////////////////// // getBackground: { - enumerable: true, value: function (element) { //TODO: Return object with all background properties console.log(ElementsMediator.getProperty(element, 'background-color')); @@ -167,7 +138,6 @@ exports.ColorController = Montage.create(Component, { //////////////////////////////////////////////////////////////////// // getBorder: { - enumerable: true, value: function (element) { } @@ -175,7 +145,6 @@ exports.ColorController = Montage.create(Component, { //////////////////////////////////////////////////////////////////// // setColor: { - enumerable: true, value: function (mode, color, isFill, selection) { var elements; //The selection is optional, if none, it asks for the currently selected elements @@ -195,7 +164,6 @@ exports.ColorController = Montage.create(Component, { //////////////////////////////////////////////////////////////////// // handleChange: { - enumerable: true, value: function (e) { // var color, input = e._event.input, panelMode, mode = e._event.mode; @@ -244,7 +212,6 @@ exports.ColorController = Montage.create(Component, { //////////////////////////////////////////////////////////////////// //Converts CSS to a color object to be used by the color model getColorObjFromCss: { - enumerable: true, value: function (css) { // var color, arr, i, j, temp, c, gradient; @@ -341,7 +308,6 @@ exports.ColorController = Montage.create(Component, { //////////////////////////////////////////////////////////////////// //Parses simple solid CSS string into color object parseCssToColor: { - enumerable: true, value: function (css) { var color, r, p; //Parsing string and converting into color object @@ -368,4 +334,6 @@ exports.ColorController = Montage.create(Component, { return color; } } + //////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////// }); \ No newline at end of file -- cgit v1.2.3