Bug 520872: Make zooming transition better [r=mark.finkle]

This commit is contained in:
Benjamin Stover 2009-10-21 19:11:38 -04:00
parent 2a9176c010
commit 738beba85b

View File

@ -343,5 +343,14 @@ Rect.prototype = {
this.right = f.call(this, this.right);
this.bottom = f.call(this, this.bottom);
return this;
},
/** Ensure this rectangle is inside the other, if possible. Preserves w, h. */
translateInside: function translateInside(other) {
let offsetX = (this.left < other.left ? other.left - this.left :
(this.right > other.right ? this.right - other.right : 0));
let offsetY = (this.top < other.top ? other.top - this.top :
(this.bottom > other.bottom ? this.bottom - other.bottom : 0));
return this.translate(offsetX, offsetY);
}
};