Spec-Zone.ru › OpenJavaFX 8
javafx.scene.input

Class ZoomEvent

java.lang.Object
  • java.util.EventObject
    • javafx.event.Event
      • javafx.scene.input.InputEvent
        • javafx.scene.input.GestureEvent
          • javafx.scene.input.ZoomEvent

All Implemented Interfaces:

Serializable, Cloneable



public final class ZoomEvent
extends GestureEvent
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 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.

Since:

JavaFX 2.2

See Also:

Serialized Form

  • Field Summary

    Fields
    Modifier and Type Field and Description
    static EventType<ZoomEvent> ANY
    Common supertype for all zoom event types.
    static EventType<ZoomEvent> ZOOM
    This event occurs when user performs a zooming gesture such as dragging two fingers apart.
    static EventType<ZoomEvent> ZOOM_FINISHED
    This event occurs when a zooming gesture ends.
    static EventType<ZoomEvent> ZOOM_STARTED
    This event occurs when a zooming gesture is detected.
    • Fields inherited from class javafx.event.Event

      consumed, eventType, NULL_SOURCE_TARGET, target
    • Fields inherited from class java.util.EventObject

      source
  • Constructor Summary

    Constructors
    Constructor and Description
    ZoomEvent(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.
    ZoomEvent(Object source, EventTarget target, 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.
  • Method Summary

    All MethodsInstance MethodsConcrete Methods
    Modifier and Type Method and Description
    ZoomEvent copyFor(Object newSource, EventTarget newTarget)
    Creates and returns a copy of this event with the specified event source and target.
    ZoomEvent copyFor(Object newSource, EventTarget newTarget, EventType<ZoomEvent> type)
    Creates a copy of the given event with the given fields substituted.
    EventType<ZoomEvent> getEventType()
    Gets the event type of this event.
    double getTotalZoomFactor()
    Gets the zooming amount of this gesture.
    double getZoomFactor()
    Gets the zooming amount of this event.
    String toString()
    Returns a string representation of this ZoomEvent object.
    • Methods inherited from class javafx.scene.input.GestureEvent

      getPickResult, getSceneX, getSceneY, getScreenX, getScreenY, getX, getY, getZ, isAltDown, isControlDown, isDirect, isInertia, isMetaDown, isShiftDown, isShortcutDown
    • Methods inherited from class javafx.event.Event

      clone, consume, fireEvent, getTarget, isConsumed
    • Methods inherited from class java.util.EventObject

      getSource
    • Methods inherited from class java.lang.Object

      equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Detail

    • ANY

      public static final EventType<ZoomEvent> ANY
      Common supertype for all zoom event types.
    • ZOOM

      public static final EventType<ZoomEvent> ZOOM
      This event occurs when user performs a zooming gesture such as dragging two fingers apart.
    • ZOOM_STARTED

      public static final EventType<ZoomEvent> ZOOM_STARTED
      This event occurs when a zooming gesture is detected.
    • ZOOM_FINISHED

      public static final EventType<ZoomEvent> ZOOM_FINISHED
      This event occurs when a zooming gesture ends.
  • Constructor Detail

    • ZoomEvent

      public ZoomEvent(Object source,
                       EventTarget target,
                       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 - the source of the event. Can be null.

      Since:

      JavaFX 8.0

    • ZoomEvent

      public ZoomEvent(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 - The type of the event.

      Since:

      JavaFX 8.0

  • Method Detail

    • getZoomFactor

      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:

      The zooming amount of this event

    • getTotalZoomFactor

      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:

      The cumulative zooming amount of this gesture

    • toString

      public String toString()
      Returns a string representation of this ZoomEvent object.

      Overrides:

      toString in class GestureEvent

      Returns:

      a string representation of this ZoomEvent object.

    • copyFor

      public ZoomEvent copyFor(Object newSource,
                               EventTarget newTarget)
      Description copied from class: Event
      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.

      Overrides:

      copyFor in class GestureEvent

      Parameters:

      newSource - the new source of the copied event

      Returns:

      the event copy with the new source and target

    • copyFor

      public ZoomEvent copyFor(Object newSource,
                               EventTarget newTarget,
                               EventType<ZoomEvent> type)
      Creates a copy of the given event with the given fields substituted.

      Parameters:

      source - the new source of the copied event

      Returns:

      the event copy with the fields substituted

      Since:

      JavaFX 8.0

    • getEventType

      public EventType<ZoomEvent> getEventType()
      Description copied from class: Event
      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.

      Overrides:

      getEventType in class GestureEvent

      Returns:

      the event type

© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API