MingaEditor.FocusTree (Minga v0.1.0)

Copy Markdown View Source

Tree of visible regions, built from the per-frame Layout plus active overlays.

Mouse routing uses this tree instead of asking every handler to re-check screen coordinates. Hit-testing finds the deepest visible node at a position, and the router dispatches to that node's handler before bubbling to ancestors when a handler returns {:passthrough, state}.

Children are stored in rendered z-order from back to front. Hit-tests walk children in reverse order, so later siblings win when regions overlap.

Summary

Types

Mouse route ordered from deepest target to root for bubbling.

t()

Built focus tree, rooted at the viewport.

Functions

Builds a focus tree from a Layout. Pure; safe to call any time.

Builds a focus tree from editor or render-pipeline state.

Returns the cached focus tree from state, or builds one from the current state.

Returns the bubble path ordered from deepest node to root.

Hit-tests (row, col) and returns the deepest node whose rect contains the point.

Links parent and sibling references throughout a tree.

Returns the path starting at the deepest scrollable node under (row, col).

Adds a modal or float overlay node to the root in front of existing regions.

Types

path()

@type path() :: [MingaEditor.FocusTree.Node.t()]

Mouse route ordered from deepest target to root for bubbling.

t()

Built focus tree, rooted at the viewport.

Functions

from_layout(layout)

@spec from_layout(MingaEditor.Layout.t()) :: t()

Builds a focus tree from a Layout. Pure; safe to call any time.

from_state(state)

@spec from_state(map()) :: t()

Builds a focus tree from editor or render-pipeline state.

get(state)

@spec get(map()) :: t()

Returns the cached focus tree from state, or builds one from the current state.

hit_path(root, row, col)

@spec hit_path(t(), integer(), integer()) :: path()

Returns the bubble path ordered from deepest node to root.

hit_test(root, row, col)

@spec hit_test(t(), integer(), integer()) :: MingaEditor.FocusTree.Node.t() | nil

Hit-tests (row, col) and returns the deepest node whose rect contains the point.

scroll_path(root, row, col)

@spec scroll_path(t(), integer(), integer()) :: path()

Returns the path starting at the deepest scrollable node under (row, col).

with_overlay(root, content_type, rect, opts \\ [])

Adds a modal or float overlay node to the root in front of existing regions.