Class OverlayMoveMode
Never on by default. While it is off every mouse callback returns false after one
boolean read, and nothing is listening anyway (OverlayMoveInput attaches only while on). While
on, a press is consumed only when it lands on a panel; every other click goes to the game.
A move is held here (the overlay draws the panel where it was dragged) and reported to the
OverlayMoveMode.MoveListener 30 s after the last drag,
or when the mode is turned off. Points are canvas pixels in the space the overlay paints in. A
saved move snaps to the corner nearest the panel's centre, with offsets from that corner (see
snap(int, int, int, int, java.awt.Dimension)), so a panel nudged near the top-right keeps following the right edge when the
window is resized.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceReceives a saved move: the corner anchor nearest the panel's centre and the offsets from it (OverlayPlacementrules), or FREE with the panel's top-left when the viewport is unknown. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longA move is saved this long after the last drag ended.static final intSize of the bottom-right square that resizes instead of moving. -
Constructor Summary
ConstructorsConstructorDescriptionOverlayMoveMode(Supplier<Map<String, Rectangle>> panelBounds, Supplier<Dimension> viewport, OverlayMoveMode.MoveListener listener) -
Method Summary
Modifier and TypeMethodDescriptionvoiddisable()Turns move mode off and saves any move not saved yet.voidTurns move mode on forflowId's panel, or for every panel when it is null.booleanWhether move mode is on.booleanWhetherflowId's panel shows the move border.booleanA drag: moves or resizes the pressed panel.booleanA press: starts a move (or a resize on the corner handle).booleanA release: ends the drag.The movable panel underpin last frame's bounds (topmost wins), or null; null while off.voidpoll()Saves the held moves once 30 s have passed since the last drag (the timer calls this each second).
-
Field Details
-
AUTO_SAVE_IDLE_MS
public static final long AUTO_SAVE_IDLE_MSA move is saved this long after the last drag ended.- See Also:
-
RESIZE_HANDLE
public static final int RESIZE_HANDLESize of the bottom-right square that resizes instead of moving.- See Also:
-
-
Constructor Details
-
OverlayMoveMode
public OverlayMoveMode(Supplier<Map<String, Rectangle>> panelBounds, Supplier<Dimension> viewport, OverlayMoveMode.MoveListener listener) - Parameters:
panelBounds- last frame's panel rectangles, by panel id (the overlay's own panel bounds)viewport- the canvas size panels are clamped to, or a supplier of null when unknownlistener- receives each saved move
-
-
Method Details
-
isEnabled
public boolean isEnabled()Whether move mode is on. -
enable
Turns move mode on forflowId's panel, or for every panel when it is null. -
disable
public void disable()Turns move mode off and saves any move not saved yet. -
isMovable
WhetherflowId's panel shows the move border. -
panelAt
-
onPress
A press: starts a move (or a resize on the corner handle). Consumed only over a movable panel. -
onDrag
A drag: moves or resizes the pressed panel. Consumed only while a panel is being dragged. -
onRelease
A release: ends the drag. Consumed only when it ends one; the 30 s save timer starts here. -
poll
public void poll()Saves the held moves once 30 s have passed since the last drag (the timer calls this each second).
-