Class HoverEventHandler

java.lang.Object
com.luciad.controllers.HoverEventHandler
All Implemented Interfaces:
AutoCloseable

public final class HoverEventHandler extends Object implements AutoCloseable
Handler that translates hover gesture events to a hovering operation.

Features under the cursor will have their FeatureState#hover() state updated.

  • Constructor Details

    • HoverEventHandler

      public HoverEventHandler()
      Creates a new instance.
  • Method Details

    • finalize

      protected void finalize()
      Overrides:
      finalize in class Object
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • onMouseMoveEvent

      @NotNull public EventResult onMouseMoveEvent(@NotNull MouseMoveEvent moveEvent, @NotNull Map map) throws NullPointerException
      Changes the FeatureState#hover() state of features located under the mouse position.
      Parameters:
      moveEvent - a move event. Cannot be null.
      map - the map. Cannot be null.
      Returns:
      whether the move event is consumed or not. Always EventResult#Consumed.
      Throws:
      NullPointerException - when passing null for the map or the event.
      See Also:
    • setMargin

      public void setMargin(long margin)
      Sets the margin used to detect if a feature is considered under the cursor or not.

      This margin is expressed in device independent pixels. By default, the margin is 5 pixels.

      Parameters:
      margin - the margin, defined in device independent pixels.
    • getMargin

      public long getMargin()
      Returns the margin used to detect if a feature is considered under the cursor or not.

      The default value is 5 pixels.

      Returns:
      the margin used to detect if a feature is considered under the cursor or not.