From e5995527e8dc567872088a9305f11c568c8bf270 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Fri, 19 Sep 2014 18:43:00 +0200 Subject: [PATCH] Support Point argument reading for Style#shadowOffset. --- src/style/Style.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/style/Style.js b/src/style/Style.js index 08ec3afd..3b0b4086 100644 --- a/src/style/Style.js +++ b/src/style/Style.js @@ -127,6 +127,7 @@ var Style = Base.extend(new function() { Base.each(defaults, function(value, key) { var isColor = /Color$/.test(key), + isPoint = key === 'shadowOffset', part = Base.capitalize(key), flag = flags[key], set = 'set' + part, @@ -190,12 +191,16 @@ var Style = Base.extend(new function() { if (value && value.clone) value = value.clone(); this._values[key] = value; - } else if (isColor && !(value && value.constructor === Color)) { - // Convert to a Color and stored result of conversion. - this._values[key] = value = Color.read([value], 0, - { readNull: true, clone: true }); - if (value) - value._owner = owner; + } else { + var ctor = isColor ? Color : isPoint ? Point : null; + if (ctor && !(value && value.constructor === ctor)) { + // Convert to a Color / Point, and stored result of the + // conversion. + this._values[key] = value = ctor.read([value], 0, + { readNull: true, clone: true }); + if (value && isColor) + value._owner = owner; + } } return value; }