public final class ZoomEvent extends GestureEvent
The event is delivered to the top-most node picked on the gesture coordinates in time of the gesture start - the whole gesture is delivered to the same node even if the coordinates change during the gesture.
The event provides two values: zoomFactor
is the zooming amount
of this event, totalZoomFactor
is the zooming amount of the whole
gesture. The values work well when multiplied with the node's scale
properties (values greater than 1
for zooming in).
As all gestures, zooming can be direct (performed directly at the concrete coordinates as on touch screen - the center point among all the touches is usually used as the gesture coordinates) or indirect (performed indirectly as on track pad - the mouse cursor location is usually used as the gesture coordinates).
The gesture's ZOOM
events are surounded by ZOOM_STARTED
and ZOOM_FINISHED
events. If zooming inertia is active on the
given platform, some ZOOM
events with isInertia()
returning
true
can come after ZOOM_FINISHED
.
Modifier and Type | Field and Description |
---|---|
static <any> |
ANY
Common supertype for all zoom event types.
|
private static long |
serialVersionUID |
private double |
totalZoomFactor |
static <any> |
ZOOM
This event occurs when user performs a zooming gesture such as
dragging two fingers apart.
|
static <any> |
ZOOM_FINISHED
This event occurs when a zooming gesture ends.
|
static <any> |
ZOOM_STARTED
This event occurs when a zooming gesture is detected.
|
private double |
zoomFactor |
Constructor and Description |
---|
ZoomEvent(<any> eventType,
double x,
double y,
double screenX,
double screenY,
boolean shiftDown,
boolean controlDown,
boolean altDown,
boolean metaDown,
boolean direct,
boolean inertia,
double zoomFactor,
double totalZoomFactor,
PickResult pickResult)
Constructs new ZoomEvent event with null source and target.
|
ZoomEvent(java.lang.Object source,
EventTarget target,
<any> eventType,
double x,
double y,
double screenX,
double screenY,
boolean shiftDown,
boolean controlDown,
boolean altDown,
boolean metaDown,
boolean direct,
boolean inertia,
double zoomFactor,
double totalZoomFactor,
PickResult pickResult)
Constructs new ZoomEvent event.
|
Modifier and Type | Method and Description |
---|---|
ZoomEvent |
copyFor(java.lang.Object newSource,
EventTarget newTarget) |
ZoomEvent |
copyFor(java.lang.Object newSource,
EventTarget newTarget,
<any> type)
Creates a copy of the given event with the given fields substituted.
|
<any> |
getEventType() |
double |
getTotalZoomFactor()
Gets the zooming amount of this gesture.
|
double |
getZoomFactor()
Gets the zooming amount of this event.
|
java.lang.String |
toString()
Returns a string representation of this
ZoomEvent object. |
getPickResult, getSceneX, getSceneY, getScreenX, getScreenY, getX, getY, getZ, isAltDown, isControlDown, isDirect, isInertia, isMetaDown, isShiftDown, isShortcutDown
private static final long serialVersionUID
public static final <any> ANY
public static final <any> ZOOM
public static final <any> ZOOM_STARTED
public static final <any> ZOOM_FINISHED
private final double zoomFactor
private final double totalZoomFactor
public ZoomEvent(java.lang.Object source, EventTarget target, <any> eventType, double x, double y, double screenX, double screenY, boolean shiftDown, boolean controlDown, boolean altDown, boolean metaDown, boolean direct, boolean inertia, double zoomFactor, double totalZoomFactor, PickResult pickResult)
source
- the source of the event. Can be null.target
- the target of the event. Can be null.eventType
- The type of the event.x
- The x with respect to the scene.y
- The y with respect to the scene.screenX
- The x coordinate relative to screen.screenY
- The y coordinate relative to screen.shiftDown
- true if shift modifier was pressed.controlDown
- true if control modifier was pressed.altDown
- true if alt modifier was pressed.metaDown
- true if meta modifier was pressed.direct
- true if the event was caused by direct input device. See GestureEvent.isDirect()
inertia
- if represents inertia of an already finished gesture.zoomFactor
- zoom amounttotalZoomFactor
- cumulative zoom amountpickResult
- pick result. Can be null, in this case a 2D pick result
without any further values is constructed
based on the scene coordinates and the targetpublic ZoomEvent(<any> eventType, double x, double y, double screenX, double screenY, boolean shiftDown, boolean controlDown, boolean altDown, boolean metaDown, boolean direct, boolean inertia, double zoomFactor, double totalZoomFactor, PickResult pickResult)
eventType
- The type of the event.x
- The x with respect to the scene.y
- The y with respect to the scene.screenX
- The x coordinate relative to screen.screenY
- The y coordinate relative to screen.shiftDown
- true if shift modifier was pressed.controlDown
- true if control modifier was pressed.altDown
- true if alt modifier was pressed.metaDown
- true if meta modifier was pressed.direct
- true if the event was caused by direct input device. See GestureEvent.isDirect()
inertia
- if represents inertia of an already finished gesture.zoomFactor
- zoom amounttotalZoomFactor
- cumulative zoom amountpickResult
- pick result. Can be null, in this case a 2D pick result
without any further values is constructed
based on the scene coordinatespublic double getZoomFactor()
scale
properties (values greater
than 1
for zooming in, values between 0
and 1
for zooming out).public double getTotalZoomFactor()
scale
properties (values greater
than 1
for zooming in, values between 0
and 1
for zooming out).public java.lang.String toString()
ZoomEvent
object.toString
in class GestureEvent
ZoomEvent
object.public ZoomEvent copyFor(java.lang.Object newSource, EventTarget newTarget)
GestureEvent
copyFor
in class GestureEvent
public ZoomEvent copyFor(java.lang.Object newSource, EventTarget newTarget, <any> type)
newSource
- the new source of the copied eventnewTarget
- the new target of the copied eventtype
- the new eventTypepublic <any> getEventType()
getEventType
in class GestureEvent