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. - 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.
- Image
Item - A raster image in a local-coord rectangle.
- Item
Flags - A bitset of per-item behavior flags.
- ItemId
- Opaque identifier for a
SceneIteminside aScene. - 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. - Path
Item - An arbitrary vector path with optional fill and stroke, in local item coordinates.
- Rect
Item - A rectangle with optional fill and stroke, in local item coordinates.
- Scene
- The data model behind a
SceneView: a flat list of entries in a parent-relative scene-graph plus aSpatialIndexfor rectangular queries. - 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
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
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. - Text
Item - Text in a local-coord rectangle, with optional alignment and rotation.
Enums§
- A11y
Bounds Space - Coordinate space the AT walker reports
SceneItembounds in. - 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.
- Cache
Mode - Per-item paint caching strategy.
- 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. - Item
Change - A change to an item’s state, fired through
Scene::item_change_signalfor every mutation. Apps observe to wire snap-to-grid, validation, side effects, etc. The model is “fire after the change has been applied” — by the time the observer sees the event, the Scene already reflects it. - 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. - 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.
- Text
Align - Horizontal alignment of a
TextItemwithin itslocal_bounds.
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§
- 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.