public final class HoverEventHandler extends Object implements AutoCloseable
Features under the cursor will have their FeatureState#hover()
state updated.
Constructor and Description |
---|
HoverEventHandler()
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected void |
finalize() |
long |
getMargin()
Returns the margin used to detect if a feature is considered under the cursor or not.
|
EventResult |
onMouseMoveEvent(MouseMoveEvent moveEvent,
Map map)
Changes the
FeatureState#hover() state of features located under the mouse position. |
void |
setMargin(long margin)
Sets the margin used to detect if a feature is considered under the cursor or not.
|
public void close()
close
in interface AutoCloseable
@NotNull public EventResult onMouseMoveEvent(@NotNull MouseMoveEvent moveEvent, @NotNull Map map) throws NullPointerException
FeatureState#hover()
state of features located under the mouse position.moveEvent
- a move event. Cannot be null
.map
- the map. Cannot be null
.EventResult#Consumed
.NullPointerException
- when passing null
for the map or the event.HoverEventHandler#setMargin
public void setMargin(long margin)
This margin is expressed in device independent pixels. By default, the margin is 5 pixels.
margin
- the margin, defined in device independent pixels.public long getMargin()
The default value is 5 pixels.