mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Support Point argument reading for Style#shadowOffset.
This commit is contained in:
parent
52dd24097f
commit
e5995527e8
1 changed files with 11 additions and 6 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue