mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 09:15:35 +00:00
Bug 520872: Make zooming transition better [r=mark.finkle]
This commit is contained in:
parent
2a9176c010
commit
738beba85b
@ -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);
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user