diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-17 07:58:27 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-17 12:15:01 -0300 |
| commit | 4350e6840940da0b7af800faf5a1455a1de1908e (patch) | |
| tree | 29f0109de63fbee2a8146c620c0f5e83065ea8d1 /examples/noc/src/system_of_systems.zig | |
| parent | 610ffe373f0f5dd5ccb59bf575f5479ad1ecdbaf (diff) | |
| download | sketchbook-4350e6840940da0b7af800faf5a1455a1de1908e.tar.gz sketchbook-4350e6840940da0b7af800faf5a1455a1de1908e.zip | |
examples/live: drag a number, the program following as it moves
The left button pressed on a number token (the grammar's `number` node
at the byte under the pointer, found with the module's parse) starts a
drag kept in State: the literal's bytes, the value, its precision. Each
pointer move rewrites the literal through the editor's `replace`: a step
for every 4 pixels right of where it was pressed (left, down), the step
from the literal's own precision (`220` by ones, `0.25` by hundredths),
printed with as many decimals. The first rewrite is a step to undo and
the rest join it, so one `u` takes the whole drag back. The text changes,
so the program is compiled and heard as it moves. A literal with an
exponent is not dragged (marked ponytail).
`update` finds the byte under the pointer as `code` lays the text out: a
character is 10 by 22 pixels, measured once (the code face at 1.25,
natively: ten M are 100) and now a constant both use, where `code` asked
the host each frame.
Test: test/live.script presses 220, drags 40 pixels right (230), back to
12 left of the press (217), lets go and undoes the drag in one step
(220). zig build test: 85 of 85 steps.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'examples/noc/src/system_of_systems.zig')
0 files changed, 0 insertions, 0 deletions
