Mercurial
comparison infinite_canvas/docs/pinning-and-context.md @ 278:8d560f50ed4c
Improve infinite canvas interactions and browser chrome
Render Lucide icons directly with Raylib, add searchable icon browsing, robust text editing, entity lifecycle animations, z-order-safe input, semantic themes, and animated editable browser controls. Document rendering, pinning, context, and component extension for future agents.
Co-authored-by: Copilot <[email protected]>
Copilot-Session: f68442b1-fa8f-46a0-9689-81710613bbd4
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Mon, 17 Aug 2026 22:16:14 -0700 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 277:1d99147f520c | 278:8d560f50ed4c |
|---|---|
| 1 # Pinning and Visible Context | |
| 2 | |
| 3 ## Pinning | |
| 4 | |
| 5 Pressing `P` toggles the selected entity through | |
| 6 `Canvas_Scene_Toggle_Selected_Pin()`. | |
| 7 | |
| 8 When pinning starts, `Canvas_Entity_Capture_Pin()` records: | |
| 9 | |
| 10 - the entity's current screen-space origin; | |
| 11 - its current screen-space size. | |
| 12 | |
| 13 After camera input, `Canvas_Scene_Sync_Pinned()` clamps that screen rectangle to | |
| 14 the viewport, converts its origin back into world coordinates, and divides its | |
| 15 screen size by the current zoom. The entity therefore still participates in the | |
| 16 world renderer and picking system, but appears fixed in the camera view while | |
| 17 the camera pans or zooms. Pinned entities are marked with the generated Lucide | |
| 18 `pin` vector, drawn through the same Raylib icon path as the gallery. | |
| 19 | |
| 20 Dragging or activating a pinned entity recaptures its screen-space state. | |
| 21 Notifications are the exception: they use the dedicated animated stack in | |
| 22 `Canvas_Scene_Update_Notification_Stack()` and cannot be toggled with `P`. | |
| 23 | |
| 24 ## Visible context | |
| 25 | |
| 26 `Canvas_Scene_Build_Visible_Context()` treats the camera viewport as the context | |
| 27 boundary: | |
| 28 | |
| 29 1. Convert the screen viewport to world bounds. | |
| 30 2. Intersect each entity's semantic bounds with that viewport. | |
| 31 3. Skip dismissed notifications. | |
| 32 4. Append identity, type, position, size, pin state, and type-specific state. | |
| 33 5. Report visible count, bytes written, and truncation. | |
| 34 | |
| 35 Zooming out expands the world-space viewport, so more entities become context. | |
| 36 Panning removes entities that no longer intersect it. The serializer preserves | |
| 37 scene order and concatenates all visible entries into one provisional text | |
| 38 snapshot. | |
| 39 | |
| 40 Examples of semantic state include text-area content/editing, dropdown | |
| 41 selection/open state, switch value, selected calendar date or table row, scroll | |
| 42 offset, image source, browser URL, and Lucide gallery scroll/renderer metadata. | |
| 43 | |
| 44 When adding an entity, never leave it on the generic `value=%d` fallback if an | |
| 45 agent would need richer meaning. Update the serializer and the viewport/context | |
| 46 tests together. |