mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 777075 - Trim the PanZoomState interface by moving some LayerController functions into PanZoomController. r=mbrubeck
This commit is contained in:
parent
48920d20cf
commit
7de6d09010
@ -137,18 +137,6 @@ public class LayerController implements PanZoomTarget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Scrolls the viewport by the given offset. You must hold the monitor while calling this. */
|
|
||||||
public void scrollBy(PointF point) {
|
|
||||||
ViewportMetrics viewportMetrics = new ViewportMetrics(mViewportMetrics);
|
|
||||||
PointF origin = viewportMetrics.getOrigin();
|
|
||||||
origin.offset(point.x, point.y);
|
|
||||||
viewportMetrics.setOrigin(origin);
|
|
||||||
mViewportMetrics = new ImmutableViewportMetrics(viewportMetrics);
|
|
||||||
|
|
||||||
notifyLayerClientOfGeometryChange();
|
|
||||||
mView.requestRender();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Sets the current page rect. You must hold the monitor while calling this. */
|
/** Sets the current page rect. You must hold the monitor while calling this. */
|
||||||
public void setPageRect(RectF rect, RectF cssRect) {
|
public void setPageRect(RectF rect, RectF cssRect) {
|
||||||
// Since the "rect" is always just a multiple of "cssRect" we don't need to
|
// Since the "rect" is always just a multiple of "cssRect" we don't need to
|
||||||
@ -195,21 +183,6 @@ public class LayerController implements PanZoomTarget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Scales the viewport, keeping the given focus point in the same place before and after the
|
|
||||||
* scale operation. You must hold the monitor while calling this.
|
|
||||||
*/
|
|
||||||
public void scaleWithFocus(float zoomFactor, PointF focus) {
|
|
||||||
ViewportMetrics viewportMetrics = new ViewportMetrics(mViewportMetrics);
|
|
||||||
viewportMetrics.scaleTo(zoomFactor, focus);
|
|
||||||
mViewportMetrics = new ImmutableViewportMetrics(viewportMetrics);
|
|
||||||
|
|
||||||
// We assume the zoom level will only be modified by the
|
|
||||||
// PanZoomController, so no need to notify it of this change.
|
|
||||||
notifyLayerClientOfGeometryChange();
|
|
||||||
mView.requestRender();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean post(Runnable action) { return mView.post(action); }
|
public boolean post(Runnable action) { return mView.post(action); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -537,6 +537,16 @@ public class PanZoomController
|
|||||||
updatePosition();
|
updatePosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void scrollBy(PointF point) {
|
||||||
|
ViewportMetrics viewportMetrics = new ViewportMetrics(getMetrics());
|
||||||
|
PointF origin = viewportMetrics.getOrigin();
|
||||||
|
origin.offset(point.x, point.y);
|
||||||
|
viewportMetrics.setOrigin(origin);
|
||||||
|
|
||||||
|
mTarget.setViewportMetrics(viewportMetrics);
|
||||||
|
mTarget.notifyLayerClientOfGeometryChange();
|
||||||
|
}
|
||||||
|
|
||||||
private void fling() {
|
private void fling() {
|
||||||
updatePosition();
|
updatePosition();
|
||||||
|
|
||||||
@ -627,7 +637,7 @@ public class PanZoomController
|
|||||||
}
|
}
|
||||||
if (! mSubscroller.scrollBy(displacement)) {
|
if (! mSubscroller.scrollBy(displacement)) {
|
||||||
synchronized (mTarget.getLock()) {
|
synchronized (mTarget.getLock()) {
|
||||||
mTarget.scrollBy(displacement);
|
scrollBy(displacement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -939,10 +949,10 @@ public class PanZoomController
|
|||||||
newZoomFactor = maxZoomFactor + excessZoom;
|
newZoomFactor = maxZoomFactor + excessZoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
mTarget.scrollBy(new PointF(mLastZoomFocus.x - detector.getFocusX(),
|
scrollBy(new PointF(mLastZoomFocus.x - detector.getFocusX(),
|
||||||
mLastZoomFocus.y - detector.getFocusY()));
|
mLastZoomFocus.y - detector.getFocusY()));
|
||||||
PointF focus = new PointF(detector.getFocusX(), detector.getFocusY());
|
PointF focus = new PointF(detector.getFocusX(), detector.getFocusY());
|
||||||
mTarget.scaleWithFocus(newZoomFactor, focus);
|
scaleWithFocus(newZoomFactor, focus);
|
||||||
}
|
}
|
||||||
|
|
||||||
mLastZoomFocus.set(detector.getFocusX(), detector.getFocusY());
|
mLastZoomFocus.set(detector.getFocusX(), detector.getFocusY());
|
||||||
@ -963,6 +973,17 @@ public class PanZoomController
|
|||||||
mTarget.notifyLayerClientOfGeometryChange();
|
mTarget.notifyLayerClientOfGeometryChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scales the viewport, keeping the given focus point in the same place before and after the
|
||||||
|
* scale operation. You must hold the monitor while calling this.
|
||||||
|
*/
|
||||||
|
private void scaleWithFocus(float zoomFactor, PointF focus) {
|
||||||
|
ViewportMetrics viewportMetrics = new ViewportMetrics(getMetrics());
|
||||||
|
viewportMetrics.scaleTo(zoomFactor, focus);
|
||||||
|
mTarget.setViewportMetrics(viewportMetrics);
|
||||||
|
mTarget.notifyLayerClientOfGeometryChange();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean getRedrawHint() {
|
public boolean getRedrawHint() {
|
||||||
switch (mState) {
|
switch (mState) {
|
||||||
case PINCHING:
|
case PINCHING:
|
||||||
|
@ -17,8 +17,6 @@ public interface PanZoomTarget {
|
|||||||
|
|
||||||
public void setAnimationTarget(ViewportMetrics viewport);
|
public void setAnimationTarget(ViewportMetrics viewport);
|
||||||
public void setViewportMetrics(ViewportMetrics viewport);
|
public void setViewportMetrics(ViewportMetrics viewport);
|
||||||
public void scrollBy(PointF point);
|
|
||||||
public void scaleWithFocus(float zoomFactor, PointF focus);
|
|
||||||
|
|
||||||
public void notifyLayerClientOfGeometryChange();
|
public void notifyLayerClientOfGeometryChange();
|
||||||
public void setForceRedraw();
|
public void setForceRedraw();
|
||||||
|
Loading…
Reference in New Issue
Block a user