HoverTransform

Implements HoverIO by transforming inputs from a "host" Hover I/O system. HoverTransform must be placed as a child of a host I/O system to function.

This node is most useful when Fluid's graphical output is transformed in post-processing. For example, Raylib users may render the user interface inside a render texture. In such situation, the mouse input would not match what is seen by the user.

HoverTransform creates a barrier between inside — its own children — and nodes outside. Inputs received from the host are transformed for all of its children, but remain unmodified outside. On the other hand, inputs created inside are untouched for other transformed nodes, but are inversely transformed for nodes outside.

hoverChain(
    vspace(
        .layout!"fill",
        button("I receive unmodified inputs", delegate { }),
        hoverTransform(
            .layout!(1, "fill"),
            Rectangle(0, 0, 100, 100),
            button("I'm transformed", delegate { })
        ),
    ),
),

Instead of managing its own set of HoverPointer instances, HoverTransform uses the host Hover I/O system for this task. For every pointer inside the host, a transformed version exists in this system. Conversely, a pointer created inside HoverTransform will have an inversely transformed version in the host system.

Note that the host system will not know that the transform has taken place. If a transformed node is hovered, the host will report that the *hover transform* node itself is hovered. To see which node is hovered, use HoverTransform's hoverOf.

@safe
class HoverTransform : NodeChain , HoverIO , Focusable , Hoverable , HoverScrollable {}

Constructors

this
this(Rectangle sourceRectangle, Node next)
this(Rectangle sourceRectangle, Rectangle destinationRectangle, Node next)

Members

Aliases

opEquals
alias opEquals = typeof(super).opEquals
Undocumented in source.

Functions

actionImpl
bool actionImpl(IO io, int hostID, InputActionID actionID, bool isActive)
Undocumented in source. Be warned that the author may not have intended to support it.
afterDraw
void afterDraw(Rectangle outer, Rectangle inner)
Undocumented in source. Be warned that the author may not have intended to support it.
afterResize
void afterResize(Vector2 )
Undocumented in source. Be warned that the author may not have intended to support it.
beforeDraw
void beforeDraw(Rectangle outer, Rectangle inner)

HoverTransform saves all the pointers it receives from the host HoverIO and creates local copies. It then transforms those, and checks its children for matching nodes.

beforeResize
void beforeResize(Vector2 )
Undocumented in source. Be warned that the author may not have intended to support it.
blocksInput
bool blocksInput()
Undocumented in source. Be warned that the author may not have intended to support it.
canScroll
bool canScroll(HoverPointer pointer)
Undocumented in source. Be warned that the author may not have intended to support it.
destinationRectangle
Rectangle destinationRectangle()
destinationRectangle
Rectangle destinationRectangle(Rectangle newValue)

Change the destination rectangle, disabling automatic destination selection.

emitEvent
void emitEvent(HoverPointer pointer, InputEvent event)
Undocumented in source. Be warned that the author may not have intended to support it.
fetch
inout(HoverPointer) fetch(int number)
Undocumented in source. Be warned that the author may not have intended to support it.
focus
void focus()
Undocumented in source. Be warned that the author may not have intended to support it.
focusImpl
bool focusImpl()
Undocumented in source. Be warned that the author may not have intended to support it.
hoverImpl
bool hoverImpl(HoverPointer pointer)
Undocumented in source. Be warned that the author may not have intended to support it.
hoverOf
inout(Hoverable) hoverOf(HoverPointer pointer)
Undocumented in source. Be warned that the author may not have intended to support it.
hoverOf
inout(Hoverable) hoverOf(int pointerID)
Undocumented in source. Be warned that the author may not have intended to support it.
inBoundsImpl
IsOpaque inBoundsImpl(Rectangle outer, Rectangle inner, Vector2 position)
Undocumented in source. Be warned that the author may not have intended to support it.
isFocused
bool isFocused()
Undocumented in source. Be warned that the author may not have intended to support it.
isHovered
bool isHovered(Hoverable hoverable)
Undocumented in source. Be warned that the author may not have intended to support it.
isHovered
bool isHovered()
Undocumented in source. Be warned that the author may not have intended to support it.
load
int load(HoverPointer pointer)
Undocumented in source. Be warned that the author may not have intended to support it.
opApply
int opApply(int delegate(HoverPointer) @(safe) yield)
Undocumented in source. Be warned that the author may not have intended to support it.
opApply
int opApply(int delegate(Hoverable) @(safe) yield)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(Object other)
Undocumented in source. Be warned that the author may not have intended to support it.
pointToHost
Vector2 pointToHost(Vector2 point)

Transform a point in destinationRectangle onto sourceRectangle.

pointToLocal
Vector2 pointToLocal(Vector2 point)

Transform a point in sourceRectangle onto destinationRectangle.

pointerToHost
inout(HoverPointer) pointerToHost(HoverPointer pointer)

Reverse pointer transform. Transform pointers from the local, transformed space, into the space of the host.

pointerToLocal
inout(HoverPointer) pointerToLocal(HoverPointer pointer)

Transform a pointer into a new position.

scrollImpl
bool scrollImpl(HoverPointer pointer)
Undocumented in source. Be warned that the author may not have intended to support it.
scrollOf
inout(HoverScrollable) scrollOf(HoverPointer pointer)
Undocumented in source. Be warned that the author may not have intended to support it.
scrollOf
inout(HoverScrollable) scrollOf(int pointerID)
Undocumented in source. Be warned that the author may not have intended to support it.
shallowScrollTo
Rectangle shallowScrollTo(const(Node) child, Rectangle parentBox, Rectangle childBox)
Undocumented in source. Be warned that the author may not have intended to support it.
sourceRectangle
Rectangle sourceRectangle()
sourceRectangle
Rectangle sourceRectangle(Rectangle newValue)

Change the source rectangle.

Mixins

__anonymous
mixin controlIO
Undocumented in source.

Variables

focusIO
FocusIO focusIO;
Undocumented in source.
hoverIO
HoverIO hoverIO;
Undocumented in source.
isDestinationManual
bool isDestinationManual;

By default, the destination rectangle is automatically updated to match the padding box of the transform's child node. If toggled on, it is instead static, and can be manually updated.

Inherited Members

From NodeChain

next
Node next(Node value)

Set the next node in chain.

next
inout(Node) next()
nextChain
inout(NodeChain) nextChain()
beforeResize
void beforeResize(Vector2 space)
Undocumented in source. Be warned that the author may not have intended to support it.
afterResize
void afterResize(Vector2 space)
Undocumented in source. Be warned that the author may not have intended to support it.
beforeDraw
void beforeDraw(Rectangle outer, Rectangle inner)
Undocumented in source. Be warned that the author may not have intended to support it.
afterDraw
void afterDraw(Rectangle outer, Rectangle inner)
Undocumented in source. Be warned that the author may not have intended to support it.
resizeImpl
void resizeImpl(Vector2 space)
Undocumented in source. Be warned that the author may not have intended to support it.
drawImpl
void drawImpl(Rectangle outer, Rectangle inner)
Undocumented in source. Be warned that the author may not have intended to support it.

From HoverIO

load
int load(HoverPointer pointer)

Load a hover pointer (mouse cursor, finger) and place it at the position currently indicated in the struct. Update the pointer's position if already loaded.

fetch
inout(HoverPointer) fetch(int number)

Fetch a pointer from a number assigned to it by this I/O. This is used by Actionable nodes to find HoverPointer data corresponding to fired input action events.

emitEvent
void emitEvent(HoverPointer pointer, InputEvent event)

Read an input event from an input device. Input devices will call this function every frame if an input event (such as a button press) occurs. Moving a mouse does not qualify as an input event.

hoverOf
inout(Hoverable) hoverOf(HoverPointer pointer)
scrollOf
inout(HoverScrollable) scrollOf(HoverPointer pointer)
isHovered
bool isHovered(Hoverable hoverable)
opApply
int opApply(int delegate(HoverPointer) @(safe) yield)

List all active hover pointer, namely all pointers that have been loaded since the last resize.

opApply
int opApply(int delegate(Hoverable) @(safe) yield)

List all currently hovered nodes.

From Focusable

focusImpl
bool focusImpl()

Handle input. Called each frame when focused.

focus
void focus()

Set focus to this node.

isFocused
bool isFocused()

From Hoverable

hoverImpl
bool hoverImpl(HoverPointer pointer)

Handle input. Called each frame when focused.

isHovered
bool isHovered()

From HoverScrollable

canScroll
bool canScroll(HoverPointer pointer)

Determines whether this node can accept scroll input and if the input can have visible effect. This is usually determined by the node's position; for example a container node already scrolled to the bottom cannot accept further vertical movement down.

scrollImpl
bool scrollImpl(HoverPointer pointer)

Perform a scroll motion, moving the node's contents by the specified distance.

shallowScrollTo
Rectangle shallowScrollTo(Node child, Rectangle parentBox, Rectangle childBox)

Scroll towards a specified child node, trying to get it into view.

opEquals
bool opEquals(Object other)

Memory safe and const object comparison.

Meta