From f8320257c074f0c552d24069861014c2e5a9ac56 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Mon, 2 Jul 2012 10:09:10 -0700 Subject: Fix: IKNINJA-1634 Fixing reference error for gradient stops on click. --- js/components/gradientpicker.reel/gradientpicker.js | 1 + 1 file changed, 1 insertion(+) (limited to 'js/components') diff --git a/js/components/gradientpicker.reel/gradientpicker.js b/js/components/gradientpicker.reel/gradientpicker.js index f912eb51..2627683c 100755 --- a/js/components/gradientpicker.reel/gradientpicker.js +++ b/js/components/gradientpicker.reel/gradientpicker.js @@ -148,6 +148,7 @@ exports.GradientPicker = Montage.create(Component, { //Storing refereces to buttons and actual stop container button.stop = stop; tooltip.stop = stop; + holder.stop = stop; stop.button = button; //Adding stop to container this.trackChips.appendChild(stop); -- cgit v1.2.3 From 8966fc4903f0eec61816d9b9bdbcac9b7d99c320 Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Mon, 2 Jul 2012 13:19:00 -0700 Subject: Bug: Font Name & Size not updating text tool Signed-off-by: Armen Kesablyan --- .../text-properties.reel/text-properties.css | 4 + .../text-properties.reel/text-properties.html | 120 +++++----- .../text-properties.reel/text-properties.js | 261 +++++---------------- 3 files changed, 112 insertions(+), 273 deletions(-) (limited to 'js/components') diff --git a/js/components/tools-properties/text-properties.reel/text-properties.css b/js/components/tools-properties/text-properties.reel/text-properties.css index 586cdcd5..7ab3ae9a 100755 --- a/js/components/tools-properties/text-properties.reel/text-properties.css +++ b/js/components/tools-properties/text-properties.reel/text-properties.css @@ -39,6 +39,10 @@ width: 160px; } +.optionsTextTool .montage-button:hover { + color:#FFF; +} + .fontColorChipContainer { margin-left: 10px !important; margin-right: 0px; diff --git a/js/components/tools-properties/text-properties.reel/text-properties.html b/js/components/tools-properties/text-properties.reel/text-properties.html index 8899ff3c..6a94cf0a 100755 --- a/js/components/tools-properties/text-properties.reel/text-properties.html +++ b/js/components/tools-properties/text-properties.reel/text-properties.html @@ -11,79 +11,87 @@ - - - - + } + } + } + + + - + - + + + diff --git a/js/components/colorbar.reel/colorbar.js b/js/components/colorbar.reel/colorbar.js index 4f3577d9..808ada4e 100755 --- a/js/components/colorbar.reel/colorbar.js +++ b/js/components/colorbar.reel/colorbar.js @@ -30,152 +30,152 @@ POSSIBILITY OF SUCH DAMAGE. //////////////////////////////////////////////////////////////////////// // -var Montage = require("montage/core/core").Montage, - Component = require("montage/ui/component").Component; +var Montage = require("montage/core/core").Montage, + Component = require("montage/ui/component").Component; //////////////////////////////////////////////////////////////////////// //Exporting as ColorBar exports.ColorBar = Montage.create(Component, { - //////////////////////////////////////////////////////////////////// - //No reel needed since it's just a bar component - hasTemplate: { + //////////////////////////////////////////////////////////////////// + //No reel needed since it's just a bar component + hasTemplate: { value: true }, //////////////////////////////////////////////////////////////////// //Width of spectrum (not including b/w buttons) _colorBarSpectrumWidth: { - value: null + value: null }, //////////////////////////////////////////////////////////////////// //Width of spectrum steps (used to calculate size of B/W buttons) _colorBarSpectrumWidthSteps: { - value: 10 + value: 10 }, //////////////////////////////////////////////////////////////////// //Default value _value: { value: {h: 0, s: 0, v: 0} }, - //////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////// //HSV Value selected from bar value: { get: function() {return this._value;}, set: function(value) { - if (value) { - //Checking for limits (Max and Min HSV values) - if (value.h > Math.PI*2) { - value.h = Math.PI*2; - } else if (value.h < 0) { - value.h = 0; - } - // - if (value.s > 1) { - value.s = 1; - } else if (value.s < 0) { - value.s = 0; - } - // - if (value.v > 1) { - value.v = 1; - } else if (value.v < 0) { - value.v = 0; - } - //Setting value - this._value = value; - // - if (!this._isMouseDown) { - this._dispatchActionEvent('change', true); - } + if (value) { + //Checking for limits (Max and Min HSV values) + if (value.h > Math.PI*2) { + value.h = Math.PI*2; + } else if (value.h < 0) { + value.h = 0; + } + // + if (value.s > 1) { + value.s = 1; + } else if (value.s < 0) { + value.s = 0; + } + // + if (value.v > 1) { + value.v = 1; + } else if (value.v < 0) { + value.v = 0; + } + //Setting value + this._value = value; + // + if (!this._isMouseDown) { + this._dispatchActionEvent('change', true); + } } } }, //////////////////////////////////////////////////////////////////// // prepareForDraw: { - value: function() { - //Nothing - } + value: function() { + //Nothing + } }, //////////////////////////////////////////////////////////////////// //Setting up and drawing canvas to object willDraw: { - value: function() { - //Setting the width and height of the canvas to match container - this.element.width = parseInt(window.getComputedStyle(this.element, null).width); - this.element.height = parseInt(window.getComputedStyle(this.element, null).height); - } + value: function() { + //Setting the width and height of the canvas to match container + this.element.width = parseInt(window.getComputedStyle(this.element, null).width); + this.element.height = parseInt(window.getComputedStyle(this.element, null).height); + } }, //////////////////////////////////////////////////////////////////// // draw: { - value: function () { - //Local variables - var cb_canvas = this.element, cb_ctx, cb_grdnt, cb_slc, cb_gwidth, PI = Math.PI, i; - //calculating width of spectrum (remainder is used for B/W buttons) - cb_gwidth = Math.round(cb_canvas.width - cb_canvas.width/this._colorBarSpectrumWidthSteps); - //Context and Gradient - cb_ctx = cb_canvas.getContext('2d'); - cb_grdnt = cb_ctx.createLinearGradient(0, cb_canvas.height, cb_gwidth, cb_canvas.height); - //////////////////////////////////////////////////////// - //Looping through set intervals (Creating spectrum) - for (i=0; i<60; i++) { - //Calculating slice number - cb_slc = Math.round(255*i/60); - //Creating gradient slices (6 colors in color theory) - cb_grdnt.addColorStop(i/360, 'rgb(255, '+cb_slc+', 0)'); - cb_grdnt.addColorStop((i+60)/360, 'rgb('+(255-cb_slc)+', 255, 0)'); - cb_grdnt.addColorStop((i+120)/360, 'rgb(0, 255, '+cb_slc+')'); - cb_grdnt.addColorStop((i+180)/360, 'rgb(0, '+(255-cb_slc)+', 255)'); - cb_grdnt.addColorStop((i+240)/360, 'rgb('+cb_slc+', 0, 255)'); - cb_grdnt.addColorStop((i+300)/360, 'rgb(255, 0,'+(255-cb_slc)+')'); - } - //Adding Color Bar to the canvas (Gradients) - cb_ctx.fillStyle = cb_grdnt; - cb_ctx.fillRect(0, 0, cb_gwidth, cb_canvas.height); - //////////////////////////////////////////////////////// - //White Gradient overlay to simulate L - cb_grdnt = cb_ctx.createLinearGradient(0, 0, 0, cb_canvas.height); - cb_grdnt.addColorStop(0.0, 'rgba(255, 255, 255, 1)'); - cb_grdnt.addColorStop(0.5, 'rgba(255, 255, 255, 0)'); - cb_ctx.fillStyle = cb_grdnt; - cb_ctx.fillRect(0, 0, cb_gwidth, cb_canvas.height); - //Black Gradient overlay to simulate S - cb_grdnt = cb_ctx.createLinearGradient(0,0,0,cb_canvas.height); - cb_grdnt.addColorStop(0.5, 'rgba(0, 0, 0, 0)'); - cb_grdnt.addColorStop(1.0, 'rgba(0, 0, 0, 1)'); - cb_ctx.fillStyle = cb_grdnt; - cb_ctx.fillRect(0, 0, cb_gwidth, cb_canvas.height); - //Black "button" - cb_ctx.fillStyle = "#000"; - cb_ctx.fillRect(cb_gwidth, cb_canvas.height/2, cb_gwidth, cb_canvas.height/2); - //Black line divider - cb_ctx.fillStyle = "#000"; - cb_ctx.fillRect(cb_gwidth-1, 0, cb_gwidth+1, cb_canvas.height); - //White "button" - cb_ctx.fillStyle = "#FFF"; - cb_ctx.fillRect(cb_gwidth, 0, cb_gwidth, cb_canvas.height/2); - //Saving - cb_ctx.restore(); - cb_ctx.save(); - //Cleaning up - cb_canvas = cb_ctx = cb_grdnt = cb_slc = cb_gwidth = PI = i = null; - } + value: function () { + //Local variables + var cb_canvas = this.element, cb_ctx, cb_grdnt, cb_slc, cb_gwidth, PI = Math.PI, i; + //calculating width of spectrum (remainder is used for B/W buttons) + cb_gwidth = Math.round(cb_canvas.width - cb_canvas.width/this._colorBarSpectrumWidthSteps); + //Context and Gradient + cb_ctx = cb_canvas.getContext('2d'); + cb_grdnt = cb_ctx.createLinearGradient(0, cb_canvas.height, cb_gwidth, cb_canvas.height); + //////////////////////////////////////////////////////// + //Looping through set intervals (Creating spectrum) + for (i=0; i<60; i++) { + //Calculating slice number + cb_slc = Math.round(255*i/60); + //Creating gradient slices (6 colors in color theory) + cb_grdnt.addColorStop(i/360, 'rgb(255, '+cb_slc+', 0)'); + cb_grdnt.addColorStop((i+60)/360, 'rgb('+(255-cb_slc)+', 255, 0)'); + cb_grdnt.addColorStop((i+120)/360, 'rgb(0, 255, '+cb_slc+')'); + cb_grdnt.addColorStop((i+180)/360, 'rgb(0, '+(255-cb_slc)+', 255)'); + cb_grdnt.addColorStop((i+240)/360, 'rgb('+cb_slc+', 0, 255)'); + cb_grdnt.addColorStop((i+300)/360, 'rgb(255, 0,'+(255-cb_slc)+')'); + } + //Adding Color Bar to the canvas (Gradients) + cb_ctx.fillStyle = cb_grdnt; + cb_ctx.fillRect(0, 0, cb_gwidth, cb_canvas.height); + //////////////////////////////////////////////////////// + //White Gradient overlay to simulate L + cb_grdnt = cb_ctx.createLinearGradient(0, 0, 0, cb_canvas.height); + cb_grdnt.addColorStop(0.0, 'rgba(255, 255, 255, 1)'); + cb_grdnt.addColorStop(0.5, 'rgba(255, 255, 255, 0)'); + cb_ctx.fillStyle = cb_grdnt; + cb_ctx.fillRect(0, 0, cb_gwidth, cb_canvas.height); + //Black Gradient overlay to simulate S + cb_grdnt = cb_ctx.createLinearGradient(0,0,0,cb_canvas.height); + cb_grdnt.addColorStop(0.5, 'rgba(0, 0, 0, 0)'); + cb_grdnt.addColorStop(1.0, 'rgba(0, 0, 0, 1)'); + cb_ctx.fillStyle = cb_grdnt; + cb_ctx.fillRect(0, 0, cb_gwidth, cb_canvas.height); + //Black "button" + cb_ctx.fillStyle = "#000"; + cb_ctx.fillRect(cb_gwidth, cb_canvas.height/2, cb_gwidth, cb_canvas.height/2); + //Black line divider + cb_ctx.fillStyle = "#000"; + cb_ctx.fillRect(cb_gwidth-1, 0, cb_gwidth+1, cb_canvas.height); + //White "button" + cb_ctx.fillStyle = "#FFF"; + cb_ctx.fillRect(cb_gwidth, 0, cb_gwidth, cb_canvas.height/2); + //Saving + cb_ctx.restore(); + cb_ctx.save(); + //Cleaning up + cb_canvas = cb_ctx = cb_grdnt = cb_slc = cb_gwidth = PI = i = null; + } }, //////////////////////////////////////////////////////////////////// //Adding ColorBar to the element didDraw: { - value: function() { - //Adding functionality via events - this.element.addEventListener("mousedown", this, false); - this.element.addEventListener("mouseover", this, false); - this.element.addEventListener("mousemove", this, false); - } + value: function() { + //Adding functionality via events + this.element.addEventListener("mousedown", this, false); + this.element.addEventListener("mouseover", this, false); + this.element.addEventListener("mousemove", this, false); + } }, //////////////////////////////////////////////////////////////////// //Mouse Down (adds other events and updates HSV) handleMousedown: { value: function (e) { if (!this._colorBarSpectrumWidth) - this._colorBarSpectrumWidth = (this.element.width - this.element.width/this._colorBarSpectrumWidthSteps)-1; + this._colorBarSpectrumWidth = (this.element.width - this.element.width/this._colorBarSpectrumWidthSteps)-1; this._isMouseDown = true; document.addEventListener("mouseup", this, false); this._updateHsv(e); @@ -184,7 +184,7 @@ exports.ColorBar = Montage.create(Component, { //////////////////////////////////////////////////////////////////// //Used to check mouse mode and display cursor _isMouseDown: { - value: false + value: false }, //////////////////////////////////////////////////////////////////// //Mouse Move (updates HSV) @@ -209,27 +209,27 @@ exports.ColorBar = Montage.create(Component, { //////////////////////////////////////////////////////////////////// //Updating HSV values _updateHsv: { - value: function (e) { - if (e.offsetX > this._colorBarSpectrumWidth) { - //Faking button functionality - Simple B/W selection - if (e.offsetY >= this.element.offsetHeight/2) { this.value = {h: this.value.h, s: 1, v: 0};} // White - else { this.value = {h: this.value.h, s: 0, v: 1};} // Black - } else { - //Checking for S or V to be applied (no mixing on bar) - if (e.offsetY >= this.element.offsetHeight/2) { //Saturation - this.value = {h: e.offsetX/this._colorBarSpectrumWidth*Math.PI*2, v: 1-(e.offsetY-this.element.offsetHeight/2)/((this.element.offsetHeight/2-1)), s: 1}; - } else { //Vibrance - this.value = {h: e.offsetX/this._colorBarSpectrumWidth*Math.PI*2, v: 1, s: (e.offsetY)/((this.element.offsetHeight/2))}; - } - } - // - this._dispatchActionEvent('changing', false); - } + value: function (e) { + if (e.offsetX > this._colorBarSpectrumWidth) { + //Faking button functionality - Simple B/W selection + if (e.offsetY >= this.element.offsetHeight/2) { this.value = {h: this.value.h, s: 1, v: 0};} // White + else { this.value = {h: this.value.h, s: 0, v: 1};} // Black + } else { + //Checking for S or V to be applied (no mixing on bar) + if (e.offsetY >= this.element.offsetHeight/2) { //Saturation + this.value = {h: e.offsetX/this._colorBarSpectrumWidth*Math.PI*2, v: 1-(e.offsetY-this.element.offsetHeight/2)/((this.element.offsetHeight/2-1)), s: 1}; + } else { //Vibrance + this.value = {h: e.offsetX/this._colorBarSpectrumWidth*Math.PI*2, v: 1, s: (e.offsetY)/((this.element.offsetHeight/2))}; + } + } + // + this._dispatchActionEvent('changing', false); + } }, //////////////////////////////////////////////////////////////////// //Dispatching "Change" event _dispatchActionEvent: { - value: function(type, userInitiated) { + value: function(type, userInitiated) { var actionEvent = document.createEvent("CustomEvent"); actionEvent.initEvent(type, true, true); actionEvent.type = type; diff --git a/js/components/colorbar.reel/css/colorbar.scss b/js/components/colorbar.reel/css/colorbar.scss index 086aa1ea..e9ecdc30 100755 --- a/js/components/colorbar.reel/css/colorbar.scss +++ b/js/components/colorbar.reel/css/colorbar.scss @@ -31,5 +31,5 @@ POSSIBILITY OF SUCH DAMAGE. .colorbar { - cursor: crosshair; + cursor: crosshair; } diff --git a/js/components/colorwheel.reel/colorwheel.html b/js/components/colorwheel.reel/colorwheel.html index b39479a8..4f542f88 100755 --- a/js/components/colorwheel.reel/colorwheel.html +++ b/js/components/colorwheel.reel/colorwheel.html @@ -31,39 +31,39 @@ POSSIBILITY OF SUCH DAMAGE. --> - - - - - + + + + + - - - - - + } + } + } + + + -
- - - - -
+ - +
+ + + + +
+ + diff --git a/js/components/colorwheel.reel/colorwheel.js b/js/components/colorwheel.reel/colorwheel.js index a7c70038..97a1751d 100755 --- a/js/components/colorwheel.reel/colorwheel.js +++ b/js/components/colorwheel.reel/colorwheel.js @@ -30,14 +30,14 @@ POSSIBILITY OF SUCH DAMAGE. //////////////////////////////////////////////////////////////////////// // -var Montage = require("montage/core/core").Montage, - Component = require("montage/ui/component").Component; +var Montage = require("montage/core/core").Montage, + Component = require("montage/ui/component").Component; //////////////////////////////////////////////////////////////////////// // exports.ColorWheel = Montage.create(Component, { - //////////////////////////////////////////////////////////////////// - // - hasTemplate: { + //////////////////////////////////////////////////////////////////// + // + hasTemplate: { value: true }, //////////////////////////////////////////////////////////////////// @@ -45,7 +45,7 @@ exports.ColorWheel = Montage.create(Component, { _value: { value: {h: 0, s: 0, v: 0} }, - ///