Log inGet started
What it does

cursor

Editor cursor management — resolves cursor variants from input and picking state, normalises spec tables into the canonical shape the engine cursor namespace accepts, and forwards them via cursor.set / cursor.clear. Used by the editor's hover and click feedback to switch between visual cursor variants without per-call boilerplate.

Variant resolution priority (highest first): hover+button → button → hover → default.

Exports

  • M.normalizeSpec(spec: CursorSpec?) -> CursorSpec? — canonicalise an image or model cursor spec. Returns nil for malformed specs.
  • M.sampleState(overrides: SampleOverrides?) -> CursorState — snapshot input + picking state for variant resolution. Pass overrides to force hit / button / hovered.
  • M.resolveVariant(variants: CursorVariants, state: CursorState?) -> (CursorSpec?, string?) — pick the winning variant for state (or a fresh sampleState() if omitted). Returns the normalised spec plus the key that won.
  • M.set(spec: CursorSpec) -> boolean — normalise then install via cursor.set. Returns false for invalid specs or a missing engine namespace.
  • M.clear() -> boolean — clear the active custom cursor.
  • M.applyVariant(variants: CursorVariants, state: CursorState?) -> (CursorSpec?, string?) — resolve + install in one call, or clear when nothing matched.

Types:

  • CursorSpec = { kind: string, visible?, hideNative?, image?, model? }.
  • CursorImage = { src, size?, hotspot?, scale?, rotation? }.
  • CursorModel = { url, size?, hotspot?, scale?, rotationQuat?, offset?, billboard? }.
  • CursorVariants = { default?, hover?, button?, "hover+button"?, hoverButton? }.
  • SampleOverrides = { hit?, button?, hovered? }.
  • CursorState = { hit, hovered, hoveredEntityId, button, buttonDown, pointerLocked }.

Usage

local Cursor = require("@builtin::modules.engine.editor.cursor")

Cursor.applyVariant({
    default = { kind = "image", image = { src = "/cursor.svg" } },
    hover   = { kind = "image", image = { src = "/cursor_hover.svg" } },
    button  = { kind = "image", image = { src = "/cursor_press.svg" } },
})

Notes

  • normalizeSpec is the only validation entry point — every other public function routes through it. A spec that fails to normalise is silently ignored.
  • sampleState reads from Zin.state.* and Picking.* each call; it is fast enough to call every frame but does not memoise.
  • set / clear return false when the global cursor namespace is missing (engine running with cursor module disabled). Callers can treat that as "no cursor support in this build" and skip.
  • applyVariant calls clear when no variant matches, so wiring an empty variants table is a valid way to reset the cursor.

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

This asset doesn't declare a schema or structured payload.

Sub-parts

Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.

0items
This part has no composite children. See the Files segment for its leaf payloads.
This part has no leaf payloads.

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported. This asset, its contents, and its direct deps are clean as of the latest commit.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.