Expand description
teksilo-scene — pannable / zoomable scene viewport for Teksilo.
A sub-toolkit for scene-based applications — story corkboards, mind maps, node-graph editors, timeline views — where content is free-positioned at scene coordinates instead of placed by a layout algorithm. Two tiers of content coexist under one view transform:
- Heavyweight tier: any
Widget(Button, TextInput, Panel, composite components) at a parent-relative position, fully interactive and accessible, with full event / focus / animation / a11y machinery intact. - Lightweight tier:
SceneItems (paths, rects, images, custom paint) without arena overhead — for the “background furniture” of a scene where thousands of items render cheaply.
The crate is built on top of teksilo-core’s per-node set_transform
scope (which composes through hit-test, paint, and a11y) and the
platform’s pinch / scroll / animated-Signal<f32> infrastructure
— so OS gestures, reduced-motion snapping, and the four-gate idle
scheduler fall out for free.
See docs/teksilo-scene.md
for the user-facing reference and
docs/teksilo-scene-a11y.md
for the accessibility-shaping API.
§Quick start
ⓘ
use teksilo_scene::{ItemId, RectItem, Scene, SceneView};
use teksilo_canvas::{Point, Rect};
let mut scene = Scene::new();
let _w: ItemId = scene.add_widget(
my_card_widget(),
Rect::new(0.0, 0.0, 200.0, 120.0),
);
scene.add_item(
RectItem::new(Rect::new(0.0, 0.0, 50.0, 50.0)).fill(teksilo_tokens::Color::RED),
Point::new(220.0, 0.0),
);
let view = SceneView::new(scene);
tree.add(view);Structs§
- A11y
Category - App-defined category tag for AT rotor / quick-nav navigation.
Surfaced to AT clients that support categorized navigation
(VoiceOver rotor on macOS, NVDA quick-nav). Apps coin their own
tag values like
"node","connector","comment". - A11y
Group - A logical AT group. Pure structure — no visual counterpart, no hit-test, no paint. Declares AT-shape that diverges from visual scene layout (Acts containing Scene cards, Subgraphs containing Nodes, Layers containing Components).
- A11y
Group Builder - Builder for an
A11yGroup. Returned byA11yGroup::builder; consumed byScene::add_a11y_group. - A11y
Group Id - Opaque identifier for a logical AT group declared via
Scene::add_a11y_group. Stable across the lifetime of the process; safe to hash, compare, store. - Cascade
Budget - The runaway-detection budget for one scene’s change fan-out — how much work observers may generate from one batch before the drain declares the cascade non-terminating and panics.
- Debug
Overlay - Visual debug overlays painted on top of normal scene rendering.
- Grid
Hash Index - Uniform grid spatial hash. Each item is bucketed into every cell
its AABB overlaps; queries union all items from the cells the
query rect overlaps. Items whose AABB would span more than
MAX_CELLS_PER_ITEMcells are NOT bucketed — seeoversizedbelow and the module doc’s “Oversized items” section. - Group
Item - A group container with optional fill / stroke / inline label, in local item coordinates.
- Handler
Replacement - The two sides of a
Scene::set_item_handlers, as they ride anItemChange::HandlersChanged. - Image
Item - A raster image in a local-coord rectangle.
- Item
A11y Decorations - The per-item slice of the logical accessibility tree, harvested by
Scene::takeand re-attached byScene::restore. - Item
Flags - A bitset of per-item behavior flags.
- ItemId
- Opaque identifier for a
SceneIteminside aScene. - Item
Payload - A
Delegatedheavyweight entry’s type-erased payload, as it rides anItemChange::PayloadChanged. - Item
Shape - What an item’s geometry is, in local item coordinates — the single source of truth for hit-test, marquee, collision and path queries.
- Magnet
- A magnetism anchor attached to a scene item.
- Magnet
Connection - A formed connection between two magnets, delivered to the consumer’s
on_connecthandler on release (mouse) or confirm (keyboard). - Magnet
Feedback - Everything the magnetism feedback renderer needs for one frame, in
scene coordinates (the canvas is already in the view-transform
scope). The built-in renderer draws markers plus a connector; a
custom
MagnetismConfig::feedbackclosure receives the same data. - Magnet
Id - Opaque identifier for a
Magnetinside aScene. - Magnet
Marker - One magnet’s render data, handed to the feedback renderer.
- Magnet
Ref - An owned, borrow-free snapshot of one magnet, handed to the
accept/reject predicate and carried in a
MagnetConnection. - Magnet
Snap - The chosen snap when a dragged item’s magnet aligns onto another
item’s magnet. Returned by
Scene::compute_item_snap. - Magnetism
Config - Per-view magnetism configuration, installed via
SceneView::magnetism. - Minimap
Readout - Where the viewport sits inside the picture the minimap is drawing — the numbers behind the AT node’s announced value, as plain fractions.
- Paint
Key - Where an entry sits in a
SceneView’s single paint order. - Path
Item - An arbitrary vector path with optional fill and stroke, in local item coordinates.
- Placement
- Where an item sits, as one property: logical parent, paint z, position in the parent frame, and local to parent transform.
- Proposed
Change - A change a gesture is about to make, offered to the geometry constraint.
- Rect
Item - A rectangle with optional fill and stroke, in local item coordinates.
- Removed
Item - One item lifted whole out of a
Scene: its entry, its magnets and its logical-AT decorations, still owned and still carrying its originalItemId. - Replace
Rejected - A refused
Scene::replace_item: why, and the item it did not take. - Scene
- The data model behind a
SceneView: a flat list of entries in a parent-relative scene-graph plus aSpatialIndexfor rectangular queries. - Scene
Card - A heavyweight scene item’s container: surface, header, body, modes,
gestures and accessibility. See the
scene_cardmodule docs. - Scene
Change - One
ItemChangeplus the context the notification channel needs in order to be usable as a change feed rather than just a repaint trigger. - Scene
Constraints - Reactive interaction-policy bundle owned by
Scene. Apps configure pan/zoom behaviour by writing to these signals; gesture closures inSceneViewread them live, so runtime mode switches (e.g. a toolbar toggling pan locks) take effect on the next event without rebuilding the view. - Scene
Item A11y Context - Context handed to
SceneItem::accessibility. - Scene
Item Handler Set - Per-item event closures + cursor + tooltip + drop acceptance.
- Scene
Item Paint Context - Context handed to
SceneItem::paint. - Scene
List Adapter - Keeps a set of lightweight
SceneItems in sync with ateksilo_data::ListModel<T>/ListDataSource<Item = T>. - Scene
Minimap - A small thumbnail rendering of a
Scene’s content, with the live viewport rectangle highlighted. - Scene
Model - A shared, cloneable handle to a
Scene. - Scene
Region - The region a geometry query asks about.
- Scene
Scroll View - A
SceneViewwith draggable scroll bars. - Scene
Selection - Reactive selection state for a
Scene. - Scene
TapEvent - Click-style gesture envelope for scene items. Mirrors the
widget-tier [
teksilo_core::gesture::TapEvent] but with the position in scene coordinates instead of widget-local. Used by the tap / double-tap / triple-tap / long-press / context-menu handlers onSceneItemHandlerSet. - Scene
Transaction - An open transaction over a
SceneModel: every edit until it drops is one logical change. - Scene
Transaction Record - One committed transaction, delivered to the edit sink with the scene unborrowed.
- Scene
View - A pannable/zoomable viewport that renders a
Scene’s items at scene coordinates and routes user input (scroll, pinch, drag, keyboard) back into the camera signals. - Scene
View State - Snapshot of a SceneView’s view transform: pan offset, zoom
factor, and rotation in radians. Use
SceneView::stateto capture the current values;SceneView::restore_stateto apply a saved snapshot. - Scene
Write Guard - Write guard over a
SceneModel’sScene:Deref/DerefMutto the scene, with the deferred-notification contract of aSceneModelmutator. - Shape
Geometry - A [
Path] plus its flattening, computed once and shared by handle. - Text
Item - Text in a local-coord rectangle, with optional alignment and rotation.
- Transform
Chrome - Everything the chrome painter is told. Scene coordinates throughout — the
view transform is already on the canvas, exactly as for
MagnetismConfig::feedback. - Transform
Config - Per-view transform-controller configuration, installed via
SceneView::transform_controller. - Transform
Delta - What one in-flight gesture asks of the selection, stated once in scene coordinates.
- Transform
Frame - The box the handles are drawn on.
- Transform
Handle Set - A bitset of
TransformHandles — Konva’senabledAnchors, in the house style ofItemFlags. - Transform
Labels - The assistive-technology names the controller publishes.
- Transform
Session - A snapshot of the live session, handed to the three event hooks and
published by
SceneView::transform_session_signal. - TxnId
- Process-unique id for one transaction.
- Weak
Scene Model - A non-owning handle to a
Scene—SceneModelwithout the ownership. - WetLayer
- A surface for content being authored right now, which repaints without taking the scene’s item bands with it.
- WetNode
- One of a
WetLayer’s mounted paint nodes, asWetLayer::nodesreports it.
Enums§
- A11y
Mode - AT-emission strategy for
SceneView. Decides whether items / widgets that have not been placed in the app-declared logical tree appear in the AT tree by default, or are suppressed. - A11y
Node - Address of a node in the parallel logical AT tree. Lets apps uniformly target scene entries, virtual groups, and ad-hoc widgets when declaring relationships, parents, or rotor categories.
- A11y
OffScreen Mode - Off-screen visibility policy for the AT walker. Decides which scene items get emitted as synthetic AT nodes per AT-rebuild.
- A11y
Relation - AT relationship kind, applied via
Scene::add_a11y_relation. Maps to AccessKit’s relationship arrays. - Access
Subtree Mode - How the AT walker treats descendants of an item.
- Appearance
Change - Which paint-only appearance slot changed, with both sides of the write.
- Appearance
Write - What a
SceneItemappearance setter did — and, when it did anything, the value it overwrote. - Cache
Mode - Per-item paint caching strategy.
- Card
Mode - What a
SceneCardis doing. - Change
Source - Whose change this is.
- Change
Verdict - What a geometry constraint decides.
- Drag
Mode - What a
SceneView’s on-canvas pointer drag does in empty space. - Focus
Direction - Direction passed to a
SceneView::focus_ordercallback when the app wants to override the default Tab cycle. - History
Mode - What a history above the scene should do with this transaction.
- Item
Change - A change to an item’s state, fired through
Scene::item_change_signalfor every mutation. Apps observe to wire validation, persistence, telemetry, mirroring to a data layer, and other side effects. The model is “fire after the change has been applied” — by the time the observer sees the event, the Scene already reflects it, and (when the mutation came through aSceneModel) the observer may freely read and write the scene back. - Item
Selection Mode - How a region query decides whether an item is picked — Qt’s
Qt::ItemSelectionMode, one variant for one. - Live
Preview - Whether the items follow the gesture or only the frame does.
- Magnet
Role - The direction a magnet faces in a connection.
- Magnet
Verdict - The result of running the accept/reject predicate on a candidate magnet pair. “Both payloads in, reject or accept-with-payload out.”
- Magnet
Visual State - The visual state of a magnet as the feedback renderer sees it.
- Marker
Visibility - When the
SceneViewpaints magnet markers. - PanAxes
- Which axes a
SceneViewis allowed to pan along. Set on theScene(not the View) because a given scene model often makes sense at one orientation only — a horizontal timeline, a vertical timeline, a fixed-extent diagram. All views of the same scene inherit the constraint. - Replace
Item Error - Why
Scene::replace_itemcould not swap an item box. Travels inside aReplaceRejected, which also carries the item. - Restore
Error - Why
Scene::restorecould not put a salvage back. - Salvage
- The ownership an
ItemChangecannot carry, attached to the removal that produced it. - Scene
Edit - One edit inside a
SceneTransactionRecord, in application order. - Scene
Layer - Which paint band a lightweight
SceneItemsits in, relative to the heavyweight widget tier. - Scene
Selection Mode - Selection-mode discriminator. Mirrors
teksilo_data::SelectionMode. - Scroll
BarMode - How the scroll bar is presented relative to the viewport content.
- Scroll
BarPolicy - Controls when the scroll bar appears for a given axis.
- Size
Policy - How an entry’s
local_boundsis decided each layout pass. - Text
Align - Horizontal alignment of a
TextItemwithin itslocal_bounds. - Transform
Handle - One grab affordance on the selection frame.
- Transform
Op - What one gesture asks of the selection.
- Transform
Outcome - How a session finished.
- Transform
Source - Which route produced a session.
- Transform
Step - One directional nudge on a transform handle.
- TxnOutcome
- How a transaction finished.
Constants§
- DEFAULT_
EDGE_ PAN_ PX - Default distance from the viewport edge at which a pointer gesture starts panning the view, in screen pixels.
- DEFAULT_
EDGE_ PAN_ SPEED - Default auto-pan speed, in screen pixels per second.
- DEFAULT_
HANDLE_ PX - Default handle size, in screen pixels.
- DEFAULT_
PADDING_ PX - Default frame padding, in screen pixels. Chosen so the handle discs clear the selection’s own bounds: a card never owns the pixels a handle is drawn on, which is what makes the chrome grabbable over a heavyweight child.
- DEFAULT_
RETENTION_ MARGIN - Default
SceneView::retention_margin, in screen pixels. - HIT_
BAND_ SLACK - Grab tolerance added to every stroke band’s half-width, in local coordinates.
- RANK_
OVER - The
PaintKey::rankof a lightweight item in theOverband. - RANK_
UNDER - The
PaintKey::rankof a lightweight item in theUnderband. - RANK_
WIDGET - The
PaintKey::rankof a heavyweight widget entry. - ROTATE_
OFFSET_ PX - How far above the frame the rotate puck floats, in screen pixels.
- SHAPE_
FLATTEN_ TOLERANCE - Curve-flattening tolerance, in local item coordinates.
Traits§
- Scene
Item - A lightweight, paint-only scene-graph item.
- Spatial
Index - A spatial index over
ItemIds keyed by axis-aligned scene rectangles. Used bySceneforitems_in_rectqueries and bySceneViewfor viewport culling.
Functions§
- claims_
press - Whether an entry would act on a press — the occlusion rule of this module, in one predicate.
- hit_
testable - Whether an entry takes part in pointer hit-testing at all.
- pulse_
once - One-shot ease-out tween from the signal’s current value to
targetoverduration. The standard “fire on click, dismiss” / “flash a highlight” pattern. The signal must already be registered withregister_animated_item_signal(or directly viactx.register_animated_signal) for the tween to participate in idle gating. - register_
animated_ item_ signal - Register an item-owned
Signal<f32>with the SceneView’s animation scheduler. Call this from insideSceneItem::register_bindingsfor every animated signal the item exposes.