@Environment(value=CLIENT) public interface InteractiveSegment extends Segment
The currently hovered interactive segment is picked in the render process and returned there. Calling code can then decide whether to render the segment's tooltip, for example. It should also notice the currently hovered segment when a left-click occurs.
| Modifier and Type | Method and Description |
|---|---|
default java.util.Optional<InteractiveSegment> |
checkHovered(int mouseX,
int mouseY,
int x,
int y,
int w,
int h) |
void |
notifyHover() |
boolean |
onMouseClick(int mouseX,
int mouseY)
Should be called by whatever is rendering the document when a left mouse
click occurs.
|
default java.util.Optional<java.lang.String> |
tooltip()
The tooltip that should be displayed when this segment is being hovered.
|
default java.util.Optional<java.lang.String> tooltip()
boolean onMouseClick(int mouseX,
int mouseY)
The mouse coordinates are expected to be in the same frame of reference as the document.
mouseX - the X coordinate of the mouse cursor.mouseY - the Y coordinate of the mouse cursor.void notifyHover()
default java.util.Optional<InteractiveSegment> checkHovered(int mouseX, int mouseY, int x, int y, int w, int h)