Expand description
Drag policy — Draggable, position adjustment for selected elements.
Draggable extends Selectable: only objects
the user can select can be dragged. Implementations provide a single
mapping — which nudge-path Element they move — and nothing else. The
default Draggable::drag_by routes every position change through
Config::nudge, so a drag can never bypass that path: the same
feasibility check (NudgeReject::OutOfBounds keeps elements inside the
chart area) and the same rotated-frame offset mapping apply whether the
move came from a drag, a keyboard nudge, or programmatic adjustment.
Axes are draggable too, with their own rule inside the same path:
Element::Axis detaches the axis — it moves only perpendicular to its
direction (y-axes horizontally, x-axes vertically) via line_offset,
while the data area, grid, and data transform stay put. Tick positions
along the axis therefore stay aligned with the data. The data area itself
is draggable as a whole (Element::DataArea): it translates without
resizing by shifting opposite margins in tandem, and it is also resizable
via its handles (crate::resize::Resizable).
Traits§
- Drag
Config - State that owns position changes. Existing Cartesian callers use
Config; bounded chart decorations use their own SSOT without duplicating hit/drag policy. - Draggable
- A selectable object whose position can be adjusted by drag & drop.