Top Description Fields Constructors Methods
javafx.scene.input

public final Class ZoomEvent

extends GestureEvent
Class Inheritance
Imports
javafx.beans.NamedArg, javafx.event.EventTarget, .EventType

Zoom event indicates that user performed zooming gesture such as dragging two fingers apart on track pad, touch screen or other similar device.

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 surrounded 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.

Since
JavaFX 2.2

Field Summary

Modifier and TypeField and Description
public static final EventType<ZoomEvent>
ANY

Hides javafx.scene.input.GestureEvent.ANY.

Common supertype for all zoom event types.
private static final long
private final double
public static final EventType<ZoomEvent>
ZOOM

This event occurs when user performs a zooming gesture such as dragging two fingers apart.

public static final EventType<ZoomEvent>
ZOOM_FINISHED

This event occurs when a zooming gesture ends.

public static final EventType<ZoomEvent>
ZOOM_STARTED

This event occurs when a zooming gesture is detected.

private final double

Constructor Summary

AccessConstructor and Description
public
ZoomEvent(Object
the source of the event. Can be null.
source
,
EventTarget
the target of the event. Can be null.
target
,
final EventType<ZoomEvent>
The type of the event.
eventType
,
double
The x with respect to the scene.
x
,
double
The y with respect to the scene.
y
,
double
The x coordinate relative to screen.
screenX
,
double
The y coordinate relative to screen.
screenY
,
boolean
true if shift modifier was pressed.
shiftDown
,
boolean
true if control modifier was pressed.
controlDown
,
boolean
true if alt modifier was pressed.
altDown
,
boolean
true if meta modifier was pressed.
metaDown
,
boolean
true if the event was caused by direct input device. See isDirect()
direct
,
boolean
if represents inertia of an already finished gesture.
inertia
,
double
zoom amount
zoomFactor
,
double
cumulative zoom amount
totalZoomFactor
,
PickResult
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 target
pickResult
)

Constructs new ZoomEvent event.

public
ZoomEvent(final EventType<ZoomEvent>
The type of the event.
eventType
,
double
The x with respect to the scene.
x
,
double
The y with respect to the scene.
y
,
double
The x coordinate relative to screen.
screenX
,
double
The y coordinate relative to screen.
screenY
,
boolean
true if shift modifier was pressed.
shiftDown
,
boolean
true if control modifier was pressed.
controlDown
,
boolean
true if alt modifier was pressed.
altDown
,
boolean
true if meta modifier was pressed.
metaDown
,
boolean
true if the event was caused by direct input device. See isDirect()
direct
,
boolean
if represents inertia of an already finished gesture.
inertia
,
double
zoom amount
zoomFactor
,
double
cumulative zoom amount
totalZoomFactor
,
PickResult
pick result. Can be null, in this case a 2D pick result without any further values is constructed based on the scene coordinates
pickResult
)

Constructs new ZoomEvent event with null source and target.

Method Summary

Modifier and TypeMethod and Description
public ZoomEvent
copyFor(Object newSource, EventTarget newTarget)

Overrides javafx.scene.input.GestureEvent.copyFor.

Creates and returns a copy of this event with the specified event source and target.

public ZoomEvent

Returns:

the event copy with the fields substituted
copyFor
(Object
the new source of the copied event
newSource
,
EventTarget
the new target of the copied event
newTarget
,
EventType<ZoomEvent>
the new eventType
type
)

Creates a copy of the given event with the given fields substituted.

public EventType<ZoomEvent>
getEventType()

Overrides javafx.scene.input.GestureEvent.getEventType.

Gets the event type of this event.

public double

Returns:

The cumulative zooming amount of this gesture
getTotalZoomFactor
()

Gets the zooming amount of this gesture.

public double

Returns:

The zooming amount of this event
getZoomFactor
()

Gets the zooming amount of this event.

public String

Returns:

a string representation of this ZoomEvent object.
toString
()

Overrides javafx.scene.input.GestureEvent.toString.

Returns a string representation of this ZoomEvent object.

Inherited from javafx.scene.input.GestureEvent:
getPickResultgetSceneXgetSceneYgetScreenXgetScreenYgetXgetYgetZisAltDownisControlDownisDirectisInertiaisMetaDownisShiftDownisShortcutDown

Field Detail

ANYback to summary
public static final EventType<ZoomEvent> ANY

Hides javafx.scene.input.GestureEvent.ANY.

Common supertype for all zoom event types.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides javafx.scene.input.GestureEvent.serialVersionUID.

totalZoomFactorback to summary
private final double totalZoomFactor
Annotations
@SuppressWarnings:doclint:missing
ZOOMback to summary
public static final EventType<ZoomEvent> ZOOM

This event occurs when user performs a zooming gesture such as dragging two fingers apart.

ZOOM_FINISHEDback to summary
public static final EventType<ZoomEvent> ZOOM_FINISHED

This event occurs when a zooming gesture ends.

ZOOM_STARTEDback to summary
public static final EventType<ZoomEvent> ZOOM_STARTED

This event occurs when a zooming gesture is detected.

zoomFactorback to summary
private final double zoomFactor
Annotations
@SuppressWarnings:doclint:missing

Constructor Detail

ZoomEventback to summary
public ZoomEvent(Object source, EventTarget target, final EventType<ZoomEvent> 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.

Parameters
source:Object

the source of the event. Can be null.

target:EventTarget

the target of the event. Can be null.

eventType:EventType<ZoomEvent>

The type of the event.

x:double

The x with respect to the scene.

y:double

The y with respect to the scene.

screenX:double

The x coordinate relative to screen.

screenY:double

The y coordinate relative to screen.

shiftDown:boolean

true if shift modifier was pressed.

controlDown:boolean

true if control modifier was pressed.

altDown:boolean

true if alt modifier was pressed.

metaDown:boolean

true if meta modifier was pressed.

direct:boolean

true if the event was caused by direct input device. See isDirect()

inertia:boolean

if represents inertia of an already finished gesture.

zoomFactor:double

zoom amount

totalZoomFactor:double

cumulative zoom amount

pickResult:PickResult

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 target

Since
JavaFX 8.0
ZoomEventback to summary
public ZoomEvent(final EventType<ZoomEvent> 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.

Parameters
eventType:EventType<ZoomEvent>

The type of the event.

x:double

The x with respect to the scene.

y:double

The y with respect to the scene.

screenX:double

The x coordinate relative to screen.

screenY:double

The y coordinate relative to screen.

shiftDown:boolean

true if shift modifier was pressed.

controlDown:boolean

true if control modifier was pressed.

altDown:boolean

true if alt modifier was pressed.

metaDown:boolean

true if meta modifier was pressed.

direct:boolean

true if the event was caused by direct input device. See isDirect()

inertia:boolean

if represents inertia of an already finished gesture.

zoomFactor:double

zoom amount

totalZoomFactor:double

cumulative zoom amount

pickResult:PickResult

pick result. Can be null, in this case a 2D pick result without any further values is constructed based on the scene coordinates

Since
JavaFX 8.0

Method Detail

copyForback to summary
public ZoomEvent copyFor(Object newSource, EventTarget newTarget)

Overrides javafx.scene.input.GestureEvent.copyFor.

Doc from javafx.scene.input.GestureEvent.copyFor.

Creates and returns a copy of this event with the specified event source and target. If the source or target is set to null, it is replaced by the NULL_SOURCE_TARGET value.

Annotations
@Override
copyForback to summary
public ZoomEvent copyFor(Object newSource, EventTarget newTarget, EventType<ZoomEvent> type)

Creates a copy of the given event with the given fields substituted.

Parameters
newSource:Object

the new source of the copied event

newTarget:EventTarget

the new target of the copied event

type:EventType<ZoomEvent>

the new eventType

Returns:ZoomEvent

the event copy with the fields substituted

Since
JavaFX 8.0
getEventTypeback to summary
public EventType<ZoomEvent> getEventType()

Overrides javafx.scene.input.GestureEvent.getEventType.

Doc from javafx.event.Event.getEventType.

Gets the event type of this event. Objects of the same Event class can have different event types. These event types further specify what kind of event occurred.

Annotations
@Override
getTotalZoomFactorback to summary
public double getTotalZoomFactor()

Gets the zooming amount of this gesture. The factor value works well when multiplied with the node's scale properties (values greater than 1 for zooming in, values between 0 and 1 for zooming out).

Returns:double

The cumulative zooming amount of this gesture

getZoomFactorback to summary
public double getZoomFactor()

Gets the zooming amount of this event. The factor value works well when multiplied with the node's scale properties (values greater than 1 for zooming in, values between 0 and 1 for zooming out).

Returns:double

The zooming amount of this event

toStringback to summary
public String toString()

Overrides javafx.scene.input.GestureEvent.toString.

Returns a string representation of this ZoomEvent object.

Returns:String

a string representation of this ZoomEvent object.

Annotations
@Override