@UiThread public class PanZoomController extends Object
Modifier and Type | Class and Description |
---|---|
static class |
PanZoomController.InputResultDetail
Represents how a
MotionEvent was handled in Gecko. |
Modifier and Type | Field and Description |
---|---|
static int |
INPUT_RESULT_HANDLED
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 int |
INPUT_RESULT_HANDLED_CONTENT
Specifies that an input event was handled by the PanZoomController and passed on
to touch event listeners in Web content.
|
static int |
INPUT_RESULT_IGNORED
Specifies that an input event was consumed by a PanZoomController internally and
browsers should do nothing in response to the event.
|
static int |
INPUT_RESULT_UNHANDLED
Specifies that an input event was not handled by the PanZoomController for a panning
or zooming operation.
|
static int |
OVERSCROLL_FLAG_HORIZONTAL |
static int |
OVERSCROLL_FLAG_NONE
Represents which directions can be over-scrolled in the scroll container where
an input event was handled.
|
static int |
OVERSCROLL_FLAG_VERTICAL |
static int |
SCROLL_BEHAVIOR_AUTO
Specifies auto scrolling which jumps content to the desired scroll position.
|
static int |
SCROLL_BEHAVIOR_SMOOTH
Specifies smooth scrolling which animates content to the desired scroll position.
|
static int |
SCROLLABLE_FLAG_BOTTOM |
static int |
SCROLLABLE_FLAG_LEFT |
static int |
SCROLLABLE_FLAG_NONE
Represents which directions can be scrolled in the scroll container where
an input event was handled.
|
static int |
SCROLLABLE_FLAG_RIGHT |
static int |
SCROLLABLE_FLAG_TOP |
Modifier | Constructor and Description |
---|---|
protected |
PanZoomController(GeckoSession session) |
Modifier and Type | Method and Description |
---|---|
protected void |
finalize() |
float |
getScrollFactor()
Get the current scroll factor.
|
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.
|
GeckoResult<PanZoomController.InputResultDetail> |
onTouchEventForDetailResult(MotionEvent event)
Process a touch event through the pan-zoom controller.
|
GeckoResult<Integer> |
onTouchEventForResult(MotionEvent event)
Deprecated.
|
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 |
scrollToBottom()
Scroll to the bottom left corner of the screen.
|
void |
scrollToTop()
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.
|
public static final int SCROLL_BEHAVIOR_SMOOTH
public static final int SCROLL_BEHAVIOR_AUTO
public static final int INPUT_RESULT_UNHANDLED
public static final int INPUT_RESULT_HANDLED
public static final int INPUT_RESULT_HANDLED_CONTENT
public static final int INPUT_RESULT_IGNORED
public static final int SCROLLABLE_FLAG_NONE
INPUT_RESULT_HANDLED
.public static final int SCROLLABLE_FLAG_TOP
public static final int SCROLLABLE_FLAG_RIGHT
public static final int SCROLLABLE_FLAG_BOTTOM
public static final int SCROLLABLE_FLAG_LEFT
public static final int OVERSCROLL_FLAG_NONE
INPUT_RESULT_HANDLED
.public static final int OVERSCROLL_FLAG_HORIZONTAL
public static final int OVERSCROLL_FLAG_VERTICAL
protected PanZoomController(GeckoSession session)
public void setScrollFactor(float factor)
factor
- Scroll factor.public float getScrollFactor()
public void onTouchEvent(@NonNull MotionEvent event)
event
- MotionEvent to process.@Deprecated @DeprecationSchedule(version=90, id="on-touch-event-for-result") @NonNull public GeckoResult<Integer> onTouchEventForResult(@NonNull MotionEvent event)
onTouchEvent(MotionEvent)
.event
- MotionEvent to process.INPUT_RESULT_*
) constants indicating
how the event was handled.@NonNull public GeckoResult<PanZoomController.InputResultDetail> onTouchEventForDetailResult(@NonNull MotionEvent event)
onTouchEvent(MotionEvent)
.event
- MotionEvent to process.PanZoomController.InputResultDetail
).public void onMouseEvent(@NonNull MotionEvent event)
event
- MotionEvent to process.protected void finalize() throws Throwable
public void onMotionEvent(@NonNull MotionEvent event)
event
- MotionEvent to process.public void setIsLongpressEnabled(boolean isLongpressEnabled)
isLongpressEnabled
- True if Gecko should generate long-press events.@UiThread public void scrollBy(@NonNull ScreenLength width, @NonNull ScreenLength height)
SCROLL_BEHAVIOR_SMOOTH
.width
- ScreenLength
offset to scroll along X axis.height
- ScreenLength
offset to scroll along Y axis.@UiThread public void scrollBy(@NonNull ScreenLength width, @NonNull ScreenLength height, int behavior)
width
- ScreenLength
offset to scroll along X axis.height
- ScreenLength
offset to scroll along Y axis.behavior
- ScrollBehaviorType One of SCROLL_BEHAVIOR_SMOOTH
, SCROLL_BEHAVIOR_AUTO
,
that specifies how to scroll the content.@UiThread public void scrollTo(@NonNull ScreenLength width, @NonNull ScreenLength height)
SCROLL_BEHAVIOR_SMOOTH
.width
- ScreenLength
position to scroll along X axis.height
- ScreenLength
position to scroll along Y axis.@UiThread public void scrollTo(@NonNull ScreenLength width, @NonNull ScreenLength height, int behavior)
width
- ScreenLength
position to scroll along X axis.height
- ScreenLength
position to scroll along Y axis.behavior
- ScrollBehaviorType One of SCROLL_BEHAVIOR_SMOOTH
, SCROLL_BEHAVIOR_AUTO
,
that specifies how to scroll the content.@UiThread public void scrollToTop()
SCROLL_BEHAVIOR_SMOOTH
.@UiThread public void scrollToBottom()
SCROLL_BEHAVIOR_SMOOTH
.