mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-07-27 14:20:12 -04:00
Generalise all read() functions in Base.read(), fix an issue in by making sure arguments passed to initialie are never larger than length, and have Color's initialize create an RGBColor, to still be able to use Color.read().
This commit is contained in:
parent
3837ca1f14
commit
c6d79f964c
7 changed files with 22 additions and 86 deletions
src/basic
|
@ -102,19 +102,6 @@ var Size = Base.extend({
|
|||
return size;
|
||||
},
|
||||
|
||||
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) {
|
||||
var size = new Size(Size.dont);
|
||||
size.initialize.apply(size, index > 0
|
||||
? Array.prototype.slice.call(args, index) : args);
|
||||
return size;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
min: function(Size1, Size2) {
|
||||
return Size.create(
|
||||
Math.min(Size1.width, Size2.width),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue