public class ScreenLength extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DOCUMENT_HEIGHT
Units represent the entire scrollable documents height.
|
static int |
DOCUMENT_WIDTH
Units represent the entire scrollable documents width.
|
static int |
PIXEL
Pixel units.
|
static int |
VISUAL_VIEWPORT_HEIGHT
Units are in visual viewport height.
|
static int |
VISUAL_VIEWPORT_WIDTH
Units are in visual viewport width.
|
Modifier and Type | Method and Description |
---|---|
static ScreenLength |
bottom()
Create a ScreenLength of the documents height.
|
static ScreenLength |
fromPixels(double value)
Create a ScreenLength of a specific length.
|
static ScreenLength |
fromVisualViewportHeight(double value)
Create a ScreenLength that uses the visual viewport width as units.
|
static ScreenLength |
fromVisualViewportWidth(double value)
Create a ScreenLength that uses the visual viewport width as units.
|
int |
getType()
Returns the unit type of the length
The length can be one of the following:
PIXEL , VISUAL_VIEWPORT_WIDTH , VISUAL_VIEWPORT_HEIGHT , DOCUMENT_WIDTH , DOCUMENT_HEIGHT |
double |
getValue()
Returns the scalar value used to calculate length.
|
static ScreenLength |
top()
Create a ScreenLength of zero pixels length.
|
static ScreenLength |
zero()
Create a ScreenLength of zero pixels length.
|
public static final int PIXEL
public static final int VISUAL_VIEWPORT_WIDTH
public static final int VISUAL_VIEWPORT_HEIGHT
public static final int DOCUMENT_WIDTH
public static final int DOCUMENT_HEIGHT
@NonNull @AnyThread public static ScreenLength zero()
PIXEL
.@NonNull @AnyThread public static ScreenLength top()
PIXEL
. Can be used to scroll to the top of a page when used with
PanZoomController.scrollTo()@NonNull @AnyThread public static ScreenLength bottom()
DOCUMENT_HEIGHT
. Can be used to scroll to the bottom of a page when used with
PanZoomController.scrollTo(ScreenLength, ScreenLength)
@NonNull @AnyThread public static ScreenLength fromPixels(double value)
PIXEL
.value
- Pixel length.@NonNull @AnyThread public static ScreenLength fromVisualViewportWidth(double value)
VISUAL_VIEWPORT_WIDTH
. Can be used with PanZoomController.scrollBy(ScreenLength, ScreenLength)
to scroll a value of the width of visual viewport content.value
- Factor used to calculate length. A value of 2.0 would indicate a length
twice as long as the length of the visual viewports width.@NonNull @AnyThread public static ScreenLength fromVisualViewportHeight(double value)
VISUAL_VIEWPORT_HEIGHT
. Can be used with PanZoomController.scrollBy(ScreenLength, ScreenLength)
to scroll a value of the height of visual viewport content.value
- Factor used to calculate length. A value of 2.0 would indicate a length
twice as long as the length of the visual viewports height.@AnyThread public double getValue()
getType()
@AnyThread public int getType()
PIXEL
, VISUAL_VIEWPORT_WIDTH
, VISUAL_VIEWPORT_HEIGHT
, DOCUMENT_WIDTH
, DOCUMENT_HEIGHT