From 23c7ede4427f681b280bf0b97cd66ffa1c2294ff Mon Sep 17 00:00:00 2001 From: Alexis Deveria Date: Thu, 14 Oct 2010 17:35:34 +0000 Subject: [PATCH] Fixed bug where picker opacity appeared wrong git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1803 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/jgraduate/jquery.jgraduate.js | 34 +++++++--------------------- 1 file changed, 8 insertions(+), 26 deletions(-) diff --git a/editor/jgraduate/jquery.jgraduate.js b/editor/jgraduate/jquery.jgraduate.js index dd96b061..2838f70b 100644 --- a/editor/jgraduate/jquery.jgraduate.js +++ b/editor/jgraduate/jquery.jgraduate.js @@ -61,7 +61,7 @@ $.jGraduate = { Paint: function(opt) { var options = opt || {}; - this.alpha = options.alpha || 100; + this.alpha = isNaN(options.alpha) ? 100 : options.alpha; // copy paint object if (options.copy) { this.type = options.copy.type; @@ -605,33 +605,8 @@ jQuery.fn.jGraduate = }); }); - // -------------- - var thisAlpha = ($this.paint.alpha*255/100).toString(16); - while (thisAlpha.length < 2) { thisAlpha = "0" + thisAlpha; } - color = $this.paint.solidColor == "none" ? "" : $this.paint.solidColor + thisAlpha; - - $.extend($.fn.jPicker.defaults.window, { - alphaSupport: true, effects: {type: 'show',speed: 0} - }); - - colPicker.jPicker( - { - window: { title: $settings.window.pickerTitle}, - images: { clientPath: $settings.images.clientPath }, - color: { active: color, alphaSupport: true } - }, - function(color) { - $this.paint.alpha = color.val('ahex') ? Math.round((color.val('a') / 255) * 100) : 100; - $this.paint.solidColor = color.val('hex') ? color.val('hex') : "none"; - $this.paint.linearGradient = null; - okClicked(); - }, - null, - function(){ cancelClicked(); } - ); }()); - // Radial gradient (function() { var svg = document.getElementById(id + '_rg_jgraduate_svg'); @@ -1029,7 +1004,14 @@ jQuery.fn.jGraduate = // -------------- var thisAlpha = ($this.paint.alpha*255/100).toString(16); while (thisAlpha.length < 2) { thisAlpha = "0" + thisAlpha; } + thisAlpha = thisAlpha.split(".")[0]; color = $this.paint.solidColor == "none" ? "" : $this.paint.solidColor + thisAlpha; + + // This should be done somewhere else, probably + $.extend($.fn.jPicker.defaults.window, { + alphaSupport: true, effects: {type: 'show',speed: 0} + }); + colPicker.jPicker( { window: { title: $settings.window.pickerTitle },