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:
Jürg Lehni 2011-03-04 13:19:07 +00:00
parent 3837ca1f14
commit c6d79f964c
7 changed files with 22 additions and 86 deletions
src/basic

View file

@ -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),