Bug 595229 - Don't pan at start of multitouch zoom gesture [r=stechz]

This commit is contained in:
Matt Brubeck 2010-09-13 10:13:17 -07:00
parent 3d7cd9516f
commit 8db22b2819
2 changed files with 9 additions and 4 deletions

View File

@ -1324,6 +1324,11 @@ GestureModule.prototype = {
getBrowser().getPosition(scrollX, scrollY);
this._pinchScrollX = scrollX.value;
this._pinchScrollY = scrollY.value;
let [centerX, centerY] = Browser.transformClientToBrowser(window.innerWidth / 2,
window.innerHeight / 2);
this._centerX = centerX;
this._centerY = centerY;
},
_pinchUpdate: function _pinchUpdate(aEvent) {
@ -1346,8 +1351,8 @@ GestureModule.prototype = {
pY += (this._pinchScrollY - scrollY.value) / scale;
// redraw zoom canvas according to new zoom rect
let rect = Browser._getZoomRectForPoint(2 * this._pinchStartX - pX,
2 * this._pinchStartY - pY,
let rect = Browser._getZoomRectForPoint(this._centerX + this._pinchStartX - pX,
this._centerY + this._pinchStartY - pY,
this._pinchZoomLevel);
this._pinchZoom.updateTo(rect);
},

View File

@ -844,8 +844,8 @@ var Browser = {
let scrollX = {}, scrollY = {};
tab.browser.getPosition(scrollX, scrollY);
let centerX = (scrollX.value + window.innerWidth / 2) / oldZoomLevel;
let centerY = (scrollY.value + window.innerHeight / 2) / oldZoomLevel;
let [centerX, centerY] = this.transformClientToBrowser(window.innerWidth / 2,
window.innerHeight / 2);
let rect = this._getZoomRectForPoint(centerX, centerY, zoomLevel);
this.animatedZoomTo(rect);