mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 609779 - Multitouch zoom jumps to bottom of screen on short pages [r=mfinkle]
This commit is contained in:
parent
3b2fbcdd3d
commit
01531af692
@ -1128,8 +1128,8 @@ GestureModule.prototype = {
|
||||
rect.width *= scaleRatio;
|
||||
rect.height *= scaleRatio;
|
||||
|
||||
rect.translateInside(new Rect(0, 0, getBrowser().contentDocumentWidth * startScale,
|
||||
getBrowser().contentDocumentHeight * startScale));
|
||||
this.translateInside(rect, new Rect(0, 0, getBrowser().contentDocumentWidth * startScale,
|
||||
getBrowser().contentDocumentHeight * startScale));
|
||||
|
||||
// redraw zoom canvas according to new zoom rect
|
||||
this._pinchZoom.updateTo(rect);
|
||||
@ -1143,6 +1143,19 @@ GestureModule.prototype = {
|
||||
this._pinchZoom.finish();
|
||||
this._pinchZoom = null;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Ensure r0 is inside r1, if possible. Preserves w, h.
|
||||
* Same as Rect.prototype.translateInside except it aligns the top left
|
||||
* instead of the bottom right if r0 is bigger than r1.
|
||||
*/
|
||||
translateInside: function translateInside(r0, r1) {
|
||||
let offsetX = (r0.left < r1.left ? r1.left - r0.left :
|
||||
(r0.right > r1.right ? Math.max(r1.left - r0.left, r1.right - r0.right) : 0));
|
||||
let offsetY = (r0.top < r1.top ? r1.top - r0.top :
|
||||
(r0.bottom > r1.bottom ? Math.max(r1.top - r0.top, r1.bottom - r0.bottom) : 0));
|
||||
return r0.translate(offsetX, offsetY);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user