From d5e5c84ecb72869ce16a428648f71307c3d153d6 Mon Sep 17 00:00:00 2001 From: Sjon Date: Sat, 22 Dec 2012 17:49:49 +0100 Subject: [PATCH] Fixes #1172 - Color with explicit type='hex' will cast color twice --- Source/Utilities/Color.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Source/Utilities/Color.js b/Source/Utilities/Color.js index 8bcc7b14..095e4403 100644 --- a/Source/Utilities/Color.js +++ b/Source/Utilities/Color.js @@ -36,13 +36,11 @@ var Color = this.Color = new Type('Color', function(color, type){ else color = color.hexToRgb(true); } type = type || 'rgb'; - switch (type){ - case 'hsb': - var old = color; - color = color.hsbToRgb(); - color.hsb = old; - break; - case 'hex': color = color.hexToRgb(true); break; + if (type == 'hsb') + { + var old = color; + color = color.hsbToRgb(); + color.hsb = old; } color.rgb = color.slice(0, 3); color.hsb = color.hsb || color.rgbToHsb();