Skip to main content

Module pointer_query

Module pointer_query 

Source
Expand description

Continuous pointer query system for CSS-driven pointer interaction.

Exposes per-element pointer data (position, velocity, distance, angle) as CSS environment variables usable in calc() and @flow inputs.

§CSS Properties

#card {
    pointer-space: self;        /* coordinate space: self | parent | viewport */
    pointer-origin: center;     /* origin point: center | top-left | bottom-left */
    pointer-range: -1.0 1.0;   /* normalize coordinates to this range */
    pointer-smoothing: 0.1;    /* exponential smoothing (seconds) */
}

§Environment Variables

Once pointer-space is set on an element, these env() variables resolve:

  • env(pointer-x) — normalized X position
  • env(pointer-y) — normalized Y position
  • env(pointer-vx) — X velocity (units/sec)
  • env(pointer-vy) — Y velocity (units/sec)
  • env(pointer-speed) — total speed
  • env(pointer-distance) — distance from origin
  • env(pointer-angle) — angle from origin (radians)
  • env(pointer-inside) — 1.0 if pointer is inside, 0.0 otherwise
  • env(pointer-active) — 1.0 if pointer is pressed, 0.0 otherwise
  • env(pointer-pressure) — normalized touch/click pressure (0.0-1.0)
  • env(pointer-touch-count) — number of active touch points (0 for mouse)
  • env(pointer-hover-duration) — seconds since pointer entered

Structs§

ElementPointerState
Per-element continuous pointer state
PointerQueryState
Global pointer query state — tracks continuous pointer data per element.
PointerSpaceConfig
Configuration for pointer tracking on an element

Enums§

PointerOrigin
Origin point for coordinate normalization
PointerSpace
Coordinate space for pointer tracking