Fix Rectangle#center (use + instead of -).

This commit is contained in:
Jürg Lehni 2011-02-13 19:22:48 +00:00
parent 20746ad3a7
commit 6ef5183731

View file

@ -118,13 +118,13 @@ Rectangle = Base.extend({
},
getCenter: function() {
return new Point(this.x - this.width / 2, this.y - this.height / 2);
return new Point(this.x + this.width * 0.5, this.y + this.height * 0.5);
},
setCenter: function() {
var center = Point.read(arguments);
this.x = center.x - this.width / 2;
this.y = center.y - this.height / 2;
this.x = center.x - this.width * 0.5;
this.y = center.y - this.height * 0.5;
},
getTopLeft: function() {