mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Allow read() methods to receive an optional length parameter.
This commit is contained in:
parent
ecbd52cdf7
commit
3a46ac3b54
6 changed files with 12 additions and 12 deletions
|
@ -477,8 +477,8 @@ var Point = Base.extend({
|
|||
return point;
|
||||
},
|
||||
|
||||
read: function(args, index) {
|
||||
var index = index || 0, length = args.length - index;
|
||||
read: function(args, index, length) {
|
||||
var index = index || 0, length = length || args.length - index;
|
||||
if (length == 1 && args[index] instanceof Point) {
|
||||
return args[index];
|
||||
} else if (length != 0) {
|
||||
|
|
|
@ -285,8 +285,8 @@ Rectangle = Base.extend({
|
|||
},
|
||||
|
||||
statics: {
|
||||
read: function(args, index) {
|
||||
var index = index || 0, length = args.length - index;
|
||||
read: function(args, index, length) {
|
||||
var index = index || 0, length = length || args.length - index;
|
||||
if (length == 1 && args[index] instanceof Rectangle) {
|
||||
return args[index];
|
||||
} else if (length != 0) {
|
||||
|
|
|
@ -94,8 +94,8 @@ var Size = Base.extend({
|
|||
},
|
||||
|
||||
statics: {
|
||||
read: function(args, index) {
|
||||
var index = index || 0, length = args.length - index;
|
||||
read: function(args, index, length) {
|
||||
var index = index || 0, length = length || args.length - index;
|
||||
if (length == 1 && args[index] instanceof Size) {
|
||||
return args[index];
|
||||
} else if (length != 0) {
|
||||
|
|
|
@ -31,8 +31,8 @@ Color = Base.extend({
|
|||
},
|
||||
|
||||
statics: {
|
||||
read: function(args, index) {
|
||||
var index = index || 0, length = args.length - index;
|
||||
read: function(args, index, length) {
|
||||
var index = index || 0, length = length || args.length - index;
|
||||
if (length == 1 && args[index] instanceof Color) {
|
||||
return args[index];
|
||||
} else if (length != 0 && args[0] !== null) {
|
||||
|
|
|
@ -4,8 +4,8 @@ Curve = Base.extend({
|
|||
|
||||
|
||||
statics: {
|
||||
read: function(args, index) {
|
||||
var index = index || 0, length = args.length - index;
|
||||
read: function(args, index, length) {
|
||||
var index = index || 0, length = length || args.length - index;
|
||||
if (length == 1 && args[index] instanceof Curve) {
|
||||
return args[index];
|
||||
} else if (length != 0) {
|
||||
|
|
|
@ -121,8 +121,8 @@ Segment = Base.extend({
|
|||
},
|
||||
|
||||
statics: {
|
||||
read: function(args, index) {
|
||||
var index = index || 0, length = args.length - index;
|
||||
read: function(args, index, length) {
|
||||
var index = index || 0, length = length || args.length - index;
|
||||
if (length == 1 && args[index] instanceof Segment) {
|
||||
return args[index];
|
||||
} else if (length != 0) {
|
||||
|
|
Loading…
Reference in a new issue