▣
module · drop-in viewer
_markers
Marker-shape canvas command generators used by `Z.plot.points`. Mirrors the marker shapes that the deleted `egui_plot::MarkerShape` enum exposed: `circle`, `square`, `diamond`, `cross`, `plus`, `up`, `down`, `left`, `right`, `asterisk`. Unknown shapes fall back to circle with a c…
by·posted 2mo ago
What it does
_markers
Marker-shape canvas command generators used by Z.plot.points. Mirrors
the marker shapes that the deleted egui_plot::MarkerShape enum
exposed: circle, square, diamond, cross, plus, up, down,
left, right, asterisk. Unknown shapes fall back to circle with a
console warning (parity with the deleted Rust path).
Exports
M.commands(shape: MarkerShape, cx: number, cy: number, radius: number, opts: MarkerOpts?) -> { CanvasCommand }— list of canvas commands rendering the marker.
Types:
MarkerShape = "circle" | "square" | "diamond" | "cross" | "plus" | "up" | "down" | "left" | "right" | "asterisk" | string—stringfallthrough warns and falls back to circle.MarkerOpts = { fill: string?, stroke: string?, strokeWidth: number? }CanvasCommand = { [string]: any }— opaque canvas-renderer command.
Usage
local Markers = require("@builtin::modules.zui.widget._markers")
local cmds = Markers.commands("diamond", 50, 50, 4, { fill = "#fff" })
-- cmds is a list of canvas commands ready to splice into a canvas.
Notes
- Each shape returns one or more canvas commands centered at
(cx, cy)with bounding-circle radiusradius. cross,plus,asterisk,up/down/left/rightare stroke-based and fall back toopts.fill(or"#FFFFFF") for the line color when nostrokeis supplied.- Unknown shapes warn via
log.warn(when available) and fall back to the circle marker — parity with the deleted Rust enum's default arm. - Pure module — no engine state, no state owned here. Safe to call from any context.
Discussion
Scoped to this part · feeds back into the world's score.
Sign in to post.sign in
No comments yet. Be the first.