Hit-testing (spec/03 §4): keyed elements, the hit index, and the client inversion attributes.
- Keys (§4.1): every element a layer draws from a row carries its key: the layer
group's
data-frameanddata-layer(key_layer/3), the element'sdata-row(its row's ordinal in the layer's realized rows,key_row/2).resolve/2answers a key against the realized rows the Frame holds, typed as the delivery holds them, never from the attribute text; a key it no longer holds is:none. - The hit index (§4.2,
index/1): one entry per layer with keyed elements, in drawing order, each item its row and its shape in the frame's units with every group transform composed in:[row, "r", x, y, w, h],[row, "c", cx, cy, r],[row, "p", x, y, w, h, d, [a, b, c, d, e, f], filled, stroke_width]. It is model-independent, built after the bend, the projection or the layout.topmost/2is the item the client picks: the last entry's last item holding the point. - Inversion attributes (§4.3,
attrs/1):data-mw-xanddata-mw-y,d0,d1,x0,x1,widthof a linear or time scale in component pixels, anddata-mw-plot.
Copied from visualize's Visualize.Hooks.Tooltip.Items (server side) and
Visualize.Chart.Frame.sync_attrs/1 and brush_attrs/1.
Summary
Functions
The inversion attributes a frame group carries (§4.3): data-mw-x and data-mw-y,
d0,d1,x0,x1,width of the frame's x and y when each is a linear or a time scale
(time in milliseconds since the epoch, pixels in the component's coordinates, the
frame's box offset and margin included), and data-mw-plot, x0,y0,x1,y1 of the plot.
The hit index of a scene (§4.2): [%{frame, layer, items}] in drawing order, items as
the module says, [] for a scene with no keyed element.
The hit index as the JSON the client's hook reads.
A layer's group keyed with its frame's name and its position among the frame's layers.
An element drawn from the row at ordinal of its layer's realized rows, keyed.
The row a key names (§4.1): {:ok, row}, the typed row of the layer's realized rows
(rows is %{{frame, layer} => table}, the rows the Frame's contained value holds),
or :none for a key it no longer holds or cannot read.
The item a point in the frame's units lands on (§4.2): {layer, row} of the topmost
item holding it (the last entry, its last item), or :none. A path holds the point by
its box here; the client tests its d.
Types
Functions
The inversion attributes a frame group carries (§4.3): data-mw-x and data-mw-y,
d0,d1,x0,x1,width of the frame's x and y when each is a linear or a time scale
(time in milliseconds since the epoch, pixels in the component's coordinates, the
frame's box offset and margin included), and data-mw-plot, x0,y0,x1,y1 of the plot.
The hit index of a scene (§4.2): [%{frame, layer, items}] in drawing order, items as
the module says, [] for a scene with no keyed element.
The hit index as the JSON the client's hook reads.
@spec key_layer(term(), term(), term()) :: Macaw.Draw.IR.Element.t() | {:error, list()}
A layer's group keyed with its frame's name and its position among the frame's layers.
@spec key_row(term(), term()) :: Macaw.Draw.IR.Element.t() | {:error, list()}
An element drawn from the row at ordinal of its layer's realized rows, keyed.
The row a key names (§4.1): {:ok, row}, the typed row of the layer's realized rows
(rows is %{{frame, layer} => table}, the rows the Frame's contained value holds),
or :none for a key it no longer holds or cannot read.
@spec topmost(term(), term()) :: {non_neg_integer(), non_neg_integer()} | :none
The item a point in the frame's units lands on (§4.2): {layer, row} of the topmost
item holding it (the last entry, its last item), or :none. A path holds the point by
its box here; the client tests its d.