Package org.mozilla.geckoview
Class PanZoomController
Object
org.mozilla.geckoview.PanZoomController
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic @interface
static class
Represents how aMotionEvent
was handled in Gecko.static @interface
static @interface
static @interface
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Specifies that an input event was handled by the PanZoomController for a panning or zooming operation, but likely not by any touch event listeners in Web content.static final int
Specifies that an input event was handled by the PanZoomController and passed on to touch event listeners in Web content.static final int
Specifies that an input event was consumed by a PanZoomController internally and browsers should do nothing in response to the event.static final int
Specifies that an input event was not handled by the PanZoomController for a panning or zooming operation.static final int
static final int
Represents which directions can be over-scrolled in the scroll container where an input event was handled.static final int
static final int
Specifies auto scrolling which jumps content to the desired scroll position.static final int
Specifies smooth scrolling which animates content to the desired scroll position.static final int
static final int
static final int
Represents which directions can be scrolled in the scroll container where an input event was handled.static final int
static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
finalize()
float
Get the current scroll factor.boolean
onDragEvent
(DragEvent event) Process a drag event.void
onMotionEvent
(MotionEvent event) Process a non-touch motion event through the pan-zoom controller.void
onMouseEvent
(MotionEvent event) Process a touch event through the pan-zoom controller.void
onTouchEvent
(MotionEvent event) Process a touch event through the pan-zoom controller.Process a touch event through the pan-zoom controller.void
scrollBy
(ScreenLength width, ScreenLength height) Scroll the document body by an offset from the current scroll position.void
scrollBy
(ScreenLength width, ScreenLength height, int behavior) Scroll the document body by an offset from the current scroll position.void
scrollTo
(ScreenLength width, ScreenLength height) Scroll the document body to an absolute position.void
scrollTo
(ScreenLength width, ScreenLength height, int behavior) Scroll the document body to an absolute position.void
Scroll to the bottom left corner of the screen.void
Scroll to the top left corner of the screen.void
setIsLongpressEnabled
(boolean isLongpressEnabled) Set whether Gecko should generate long-press events.void
setScrollFactor
(float factor) Set the current scroll factor.
-
Field Details
-
SCROLL_BEHAVIOR_SMOOTH
public static final int SCROLL_BEHAVIOR_SMOOTHSpecifies smooth scrolling which animates content to the desired scroll position.- See Also:
-
SCROLL_BEHAVIOR_AUTO
public static final int SCROLL_BEHAVIOR_AUTOSpecifies auto scrolling which jumps content to the desired scroll position.- See Also:
-
INPUT_RESULT_UNHANDLED
public static final int INPUT_RESULT_UNHANDLEDSpecifies that an input event was not handled by the PanZoomController for a panning or zooming operation. The event may have been handled by Web content or internally (e.g. text selection).- See Also:
-
INPUT_RESULT_HANDLED
public static final int INPUT_RESULT_HANDLEDSpecifies that an input event was handled by the PanZoomController for a panning or zooming operation, but likely not by any touch event listeners in Web content.- See Also:
-
INPUT_RESULT_HANDLED_CONTENT
public static final int INPUT_RESULT_HANDLED_CONTENTSpecifies that an input event was handled by the PanZoomController and passed on to touch event listeners in Web content.- See Also:
-
INPUT_RESULT_IGNORED
public static final int INPUT_RESULT_IGNOREDSpecifies that an input event was consumed by a PanZoomController internally and browsers should do nothing in response to the event.- See Also:
-
SCROLLABLE_FLAG_NONE
public static final int SCROLLABLE_FLAG_NONERepresents which directions can be scrolled in the scroll container where an input event was handled. This value is only useful in the case ofINPUT_RESULT_HANDLED
.- See Also:
-
SCROLLABLE_FLAG_TOP
public static final int SCROLLABLE_FLAG_TOP- See Also:
-
SCROLLABLE_FLAG_RIGHT
public static final int SCROLLABLE_FLAG_RIGHT- See Also:
-
SCROLLABLE_FLAG_BOTTOM
public static final int SCROLLABLE_FLAG_BOTTOM- See Also:
-
SCROLLABLE_FLAG_LEFT
public static final int SCROLLABLE_FLAG_LEFT- See Also:
-
OVERSCROLL_FLAG_NONE
public static final int OVERSCROLL_FLAG_NONERepresents which directions can be over-scrolled in the scroll container where an input event was handled. This value is only useful in the case ofINPUT_RESULT_HANDLED
.- See Also:
-
OVERSCROLL_FLAG_HORIZONTAL
public static final int OVERSCROLL_FLAG_HORIZONTAL- See Also:
-
OVERSCROLL_FLAG_VERTICAL
public static final int OVERSCROLL_FLAG_VERTICAL- See Also:
-
-
Constructor Details
-
PanZoomController
-
-
Method Details
-
setScrollFactor
public void setScrollFactor(float factor) Set the current scroll factor. The scroll factor is the maximum scroll amount that one scroll event may generate, in device pixels.- Parameters:
factor
- Scroll factor.
-
getScrollFactor
public float getScrollFactor()Get the current scroll factor.- Returns:
- Scroll factor.
-
onTouchEvent
Process a touch event through the pan-zoom controller. Treat any mouse events as "touch" rather than as "mouse". Pointer coordinates should be relative to the display surface.- Parameters:
event
- MotionEvent to process.
-
onTouchEventForDetailResult
@NonNull public GeckoResult<PanZoomController.InputResultDetail> onTouchEventForDetailResult(@NonNull MotionEvent event) Process a touch event through the pan-zoom controller. Treat any mouse events as "touch" rather than as "mouse". Pointer coordinates should be relative to the display surface.NOTE: It is highly recommended to only call this with ACTION_DOWN or in otherwise limited capacity. Returning a GeckoResult for every touch event will generate a lot of allocations and unnecessary GC pressure. Instead, prefer to call
onTouchEvent(MotionEvent)
.- Parameters:
event
- MotionEvent to process.- Returns:
- A GeckoResult resolving to
PanZoomController.InputResultDetail
).
-
onMouseEvent
Process a touch event through the pan-zoom controller. Treat any mouse events as "mouse" rather than as "touch". Pointer coordinates should be relative to the display surface.- Parameters:
event
- MotionEvent to process.
-
finalize
-
onMotionEvent
Process a non-touch motion event through the pan-zoom controller. Currently, hover and scroll events are supported. Pointer coordinates should be relative to the display surface.- Parameters:
event
- MotionEvent to process.
-
onDragEvent
Process a drag event.- Parameters:
event
- DragEvent to process.- Returns:
- true if this event is accepted.
-
setIsLongpressEnabled
public void setIsLongpressEnabled(boolean isLongpressEnabled) Set whether Gecko should generate long-press events.- Parameters:
isLongpressEnabled
- True if Gecko should generate long-press events.
-
scrollBy
Scroll the document body by an offset from the current scroll position. UsesSCROLL_BEHAVIOR_SMOOTH
.- Parameters:
width
-ScreenLength
offset to scroll along X axis.height
-ScreenLength
offset to scroll along Y axis.
-
scrollBy
@UiThread public void scrollBy(@NonNull ScreenLength width, @NonNull ScreenLength height, int behavior) Scroll the document body by an offset from the current scroll position.- Parameters:
width
-ScreenLength
offset to scroll along X axis.height
-ScreenLength
offset to scroll along Y axis.behavior
- ScrollBehaviorType One ofSCROLL_BEHAVIOR_SMOOTH
,SCROLL_BEHAVIOR_AUTO
, that specifies how to scroll the content.
-
scrollTo
Scroll the document body to an absolute position. UsesSCROLL_BEHAVIOR_SMOOTH
.- Parameters:
width
-ScreenLength
position to scroll along X axis.height
-ScreenLength
position to scroll along Y axis.
-
scrollTo
@UiThread public void scrollTo(@NonNull ScreenLength width, @NonNull ScreenLength height, int behavior) Scroll the document body to an absolute position.- Parameters:
width
-ScreenLength
position to scroll along X axis.height
-ScreenLength
position to scroll along Y axis.behavior
- ScrollBehaviorType One ofSCROLL_BEHAVIOR_SMOOTH
,SCROLL_BEHAVIOR_AUTO
, that specifies how to scroll the content.
-
scrollToTop
@UiThread public void scrollToTop()Scroll to the top left corner of the screen. UsesSCROLL_BEHAVIOR_SMOOTH
. -
scrollToBottom
@UiThread public void scrollToBottom()Scroll to the bottom left corner of the screen. UsesSCROLL_BEHAVIOR_SMOOTH
.
-