mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-08 05:42:07 -05:00
Fix Base.read() to correctly read existing objects even when length > 1.
This commit is contained in:
parent
74167ff28d
commit
ea9a1d2c47
1 changed files with 4 additions and 6 deletions
10
src/paper.js
10
src/paper.js
|
@ -54,12 +54,10 @@ Base.inject({
|
||||||
|
|
||||||
read: function(args, index, length) {
|
read: function(args, index, length) {
|
||||||
var index = index || 0, length = length || args.length - index;
|
var index = index || 0, length = length || args.length - index;
|
||||||
if (length <= 1) {
|
var arg = args[index];
|
||||||
var arg = args[index];
|
// Return null when nothing was provided
|
||||||
// Return null when nothing was provided
|
if (arg instanceof this || arg == null && length <= 1)
|
||||||
if (arg instanceof this || arg == null)
|
return arg;
|
||||||
return arg;
|
|
||||||
}
|
|
||||||
var obj = new this(this.dont);
|
var obj = new this(this.dont);
|
||||||
obj = obj.initialize.apply(obj, index > 0 || length < args.length
|
obj = obj.initialize.apply(obj, index > 0 || length < args.length
|
||||||
? Array.prototype.slice.call(args, index, index + length)
|
? Array.prototype.slice.call(args, index, index + length)
|
||||||
|
|
Loading…
Reference in a new issue