mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-04 03:45:58 -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) {
|
Base.each(defaults, function(value, key) {
|
||||||
var isColor = /Color$/.test(key),
|
var isColor = /Color$/.test(key),
|
||||||
|
isPoint = key === 'shadowOffset',
|
||||||
part = Base.capitalize(key),
|
part = Base.capitalize(key),
|
||||||
flag = flags[key],
|
flag = flags[key],
|
||||||
set = 'set' + part,
|
set = 'set' + part,
|
||||||
|
@ -190,12 +191,16 @@ var Style = Base.extend(new function() {
|
||||||
if (value && value.clone)
|
if (value && value.clone)
|
||||||
value = value.clone();
|
value = value.clone();
|
||||||
this._values[key] = value;
|
this._values[key] = value;
|
||||||
} else if (isColor && !(value && value.constructor === Color)) {
|
} else {
|
||||||
// Convert to a Color and stored result of conversion.
|
var ctor = isColor ? Color : isPoint ? Point : null;
|
||||||
this._values[key] = value = Color.read([value], 0,
|
if (ctor && !(value && value.constructor === ctor)) {
|
||||||
{ readNull: true, clone: true });
|
// Convert to a Color / Point, and stored result of the
|
||||||
if (value)
|
// conversion.
|
||||||
value._owner = owner;
|
this._values[key] = value = ctor.read([value], 0,
|
||||||
|
{ readNull: true, clone: true });
|
||||||
|
if (value && isColor)
|
||||||
|
value._owner = owner;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue