Bug 728614 - Fix the zoom level when the device rotates on pages with <meta viewport> information; r=kats

This commit is contained in:
Ehsan Akhgari 2012-02-22 13:13:16 -05:00
Родитель c713ff7f22
Коммит 43866aa4a5
2 изменённых файлов: 10 добавлений и 14 удалений

Просмотреть файл

@ -206,7 +206,15 @@ public class LayerController {
}
}
PointF newFocus = new PointF(size.width / 2.0f, size.height / 2.0f);
// For rotations, we want the focus point to be at the top left.
boolean rotation = (size.width > oldWidth && size.height < oldHeight) ||
(size.width < oldWidth && size.height > oldHeight);
PointF newFocus;
if (rotation) {
newFocus = new PointF(0, 0);
} else {
newFocus = new PointF(size.width / 2.0f, size.height / 2.0f);
}
float newZoomFactor = size.width * oldZoomFactor / oldWidth;
mViewportMetrics.scaleTo(newZoomFactor, newFocus);

Просмотреть файл

@ -217,22 +217,10 @@ public class PanZoomController
// if that's the case, abort any animation in progress and re-zoom so that the page
// snaps to edges. for other cases (where the user's finger(s) are down) don't do
// anything special.
switch (mState) {
case FLING:
if (mState == PanZoomState.FLING) {
mX.stopFling();
mY.stopFling();
mState = PanZoomState.NOTHING;
// fall through
case ANIMATED_ZOOM:
// the zoom that's in progress likely makes no sense any more (such as if
// the screen orientation changed) so abort it
// fall through
case NOTHING:
// Don't do animations here; they're distracting and can cause flashes on page
// transitions.
mController.setViewportMetrics(getValidViewportMetrics());
mController.notifyLayerClientOfGeometryChange();
break;
}
}