After signing out and back in, a texture fill stayed in its base
colour until something else redrew the vector tab. The texture
library is a singleton that outlives the editor. Four widgets
subscribed to it and never unsubscribed. After a new sign-in the
first loaded texture called a destroyed canvas, which threw and
stopped the loop before the vector tab heard about the image.
- TextureCanvas, TileCanvas, ShaderPreview and WorldViewport now
unsubscribe in destroy(). This is the pattern FontPreview and
VectorArtCanvas already use. WorldViewport leaves both the
texture and the font library.
- FileLibrary.notifyChange catches errors per listener. A broken
listener no longer starves the others. The error is still
logged as "[textures] a listener failed".
- e2e 47i no longer forces a redraw. It waits up to 3 s for the
tab to show the texture on its own.
Findings:
- The trigger was e2e module 45 (sign out, sign in), not the
texture fill. My note in #196 that the browser showed no
exception was wrong. The counter-check shows it clearly.
Tests:
- ./check.sh: 137 files, 2051 tests, exit 0 (before 136 / 2049)
- 2 new unit tests in tests/viewport/file-library.test.ts
- GM_STEPS=45,47 after a fresh seed: ALL PASSED, 71 checks
- Counter-check with the old source and the new check: 1 FAIL
(shape stays #0000ff) plus the TypeError. Old FileLibrary.ts
fails the first unit test.
- No full e2e run locally. The check count is unchanged.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Textures are uploaded files named by their content, so they cannot
be edited in place. Pixel art is therefore its own asset type, like
vector art. Its pixels live in the project and the tab rasters them
into a texture that sprites, tiles and animations can use.
- New asset types Pixel art and Palette. The first pixel art of a
project gets a palette with the 16 PICO-8 colours in the same undo
step. Every pixel is a palette index, 0 is transparent.
- Each layer on each frame is its own file data/pixels/<sha256>.px.
The project only holds the names, so undo swaps names. The browser
computes the hash and uploads new cels before the project is saved.
- New route POST ?r=pixels in api/lib/PixelStore.php. It answers 201
and 422 for broken data. data/pixels/ is git-ignored.
- Tools: pencil, eraser, fill (contiguous or all pixels of a colour),
eyedropper, line, rectangle and ellipse (outline or filled), brush
size 1 to 8.
- Layers can be added, deleted, renamed, reordered, hidden, faded and
merged down. Frames can be added, duplicated, deleted and reordered,
with onion skin and a small playing preview.
- Zoom 1x to 32x in whole steps, grid from 8x, a 3x3 tile preview and
Resize... with a 3x3 anchor.
- All frames sit side by side in one image. Each frame is a region
like a cut texture frame, so texture rows offer "Asset / Frame 2"
and the context menu has Create animation from frames.
Decisions:
- Merging down drops the opacity of the upper layer. Indexed colours
know no blends.
- Only the last palette colour can be removed. Otherwise the indices
of every image using the palette would shift.
- Undo stores the whole layer per stroke instead of pixel diffs.
- Alt+click picks a colour. It is a mouse gesture, not a shortcut.
Follow-up issues: #197 import from texture, #198 selection and
flipping, #199 PNG export, #200 more tools.
Tests:
- ./check.sh: 136 files, 2049 tests (before 135 / 2011). 34 new in
tests/core/pixel-art.test.ts, 4 from the icon tables.
- e2e module 48 fresh: ALL PASSED, 29 checks, console empty.
- Counter-probes bite: five on the unit tests, upload order (2 tests
fail) and cels not uploaded in the browser (1 check fails).
- Check total 1259 in README is computed (1232 measured in CI + 27).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
CI run 217 for 592ea94 failed three checks in block 47i. In the full
run the texture list is longer than in a single module run, so the
picker click missed "halves" and the texture stayed empty.
- The check now types "halves" into the menu search field and picks
it with Enter, independent of the list length.
- FIND_HALVES looks the image up by name. Matching only by size had
picked the 32 px image "wedge" in the full run.
- The texture fill check forces a redraw before reading pixels. After
the work of earlier modules the vector tab does not redraw once the
texture has loaded. That bug is tracked in #196, and the forced
redraw goes away with it.
Tests:
- ./check.sh: CHECK EXIT 0
- npm run build: BUILD EXIT 0
- GM_STEPS=47 (fresh seed): ALL PASSED, 54 checks
- Full run not repeated locally. CI decides.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A vector shape could only be filled and outlined with one flat colour.
Shading, glows and patterned surfaces had to be faked with stacks of
shapes. Every shape now has a paint type for its fill and its outline.
- Fill type: solid colour, linear gradient, radial gradient or
texture. Line type offers the same without texture.
- Colour stops are edited on a bar in the inspector, as agreed in the
issue. A click on the bar adds a stop in the colour the gradient
already has there, so adding never changes the picture. At least two
stops remain.
- The new Paint tool in the tab shows two handles for the selected
shape: axis start and end, centre and radius, or the corners of one
texture tile. "Handles: Fill / Outline" picks which paint is edited.
- Moving a whole shape moves its gradients and tile with it. Every
gesture is one undo step.
- A texture fill always tiles, because Pixi turns a non-repeating
pattern into a repeating one anyway. When switched on, one tile
covers the whole shape.
- Only uploaded textures and frames can be a fill, never a drawing.
A drawing filled with itself would rasterise itself mid-raster.
- The fingerprint of a drawing includes the texture and frame a fill
points to, so the picture redraws when the image is swapped.
Findings:
- graphics.destroy(true) also destroyed the textures of the fills.
With a texture fill it deleted the tile slice and the next redraw
crashed on reading 'scaleMode' of null. It is now destroy().
- The gradient cache destroyed old gradients itself, which gave 20
Pixi warnings "destroyed while still bound". They are now handed to
Pixi's texture GC with autoGarbageCollect switched on. The console
of module 47 is empty again, the last CI log had 0 of them.
Tests:
- ./check.sh: 135 files, 2011 tests, exit 0 (before 134 / 1986)
- npm run build: exit 0
- GM_STEPS=47, freshly seeded: ALL PASSED, 54 checks (before 44),
0 console warnings
- 25 new unit tests, 10 new e2e checks in block 47i
- Four counter-checks bite, originals restored and verified with cmp
- Check sum 1232 in README and wiki, calculated (1222 + 10)
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Building a shape out of simpler ones meant drawing the result point by
point. The Vector Art tab now selects several shapes at once and
combines them with a boolean operation into one ordinary shape.
- Ctrl/Cmd+click in the tab and Ctrl or Shift+click in the shape list
add a shape to the selection. Shift stays pan in the canvas.
- A COMBINE block in the inspector offers Union, Subtract, Intersect
and Exclude. Subtract removes every upper shape from the lowest one.
- The result replaces the lowest selected shape and keeps its name,
colours, stroke and place in the order. It is one undo step.
- Curves are flattened to 0.2 canvas pixels, a circle gets about 48
points. Open lines and single shapes cannot be combined, the buttons
are off and a hint gives the reason. An empty result is rejected.
- Delete now removes every selected shape, and the selection drops
shapes that no longer exist.
- The geometry comes from clipper2-ts 2.0.1, pinned. It has no
dependencies and speaks even-odd directly. Only the engine module
is imported, the bundle grows by 55 kB instead of 110 kB.
Findings:
- clipper2-js was tried and dropped. It pulls in Angular 15 with a
high npm audit finding and no fix.
- Pixi finds holes by containment, not by even-odd depth. An island
inside a hole would be drawn as a hole again. Result rings are
emitted outer ring before its islands, and a test mirrors Pixi's
rule.
- A depth sort turned out to be dead code in a counter-check and was
removed. A pixel check in 47h stayed green without the subtract
and now checks both colours.
Tests:
- ./check.sh: 134 files, 1986 tests, exit 0 (before 133 / 1968)
- npm run build: exit 0
- GM_STEPS=47, freshly seeded: ALL PASSED, 44 checks (before 39)
- 18 new unit tests, 5 new e2e checks in block 47h
- Five counter-checks bite, originals restored and verified with cmp
- Check sum 1222 in README and wiki, calculated (1217 + 5)
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Until now only the editor toolbar could pause a running game. A pause
menu inside the game had no way to stop the world while its own graph
kept running, and there was no slow motion.
- Five new nodes: Pause game, Resume game, Is game paused, Set time
scale and Time scale. Pause and resume take effect on the next frame.
- A game pause stops world time, physics, animations, particles and
shader time. Only behaviors with the new "Run while paused" switch
keep running.
- Set time scale 0 freezes the world but graphs keep running, as
agreed in the issue.
- Play and Stop reset the time scale to 1, Load scene keeps it. The
pause belongs to the scene, so Load scene and Restart unpause.
- The toolbar pause stays separate and also freezes the menu. When the
game pauses itself the status line reads "The game paused itself".
- While paused, collision events are not reported, sounds keep
playing, and the editor run ignores both nodes with a log line.
Findings:
- The first status line was longer than any before and got cut with
an ellipsis. It is shorter now.
- The e2e harness did not know the key "p". It does now.
Tests:
- ./check.sh: 133 files, 1968 tests, exit 0 (before 132 / 1952)
- npm run build: exit 0
- GM_STEPS=18 fresh: ALL PASSED, 33 checks (before 26)
- 16 new unit tests: 8 catalog cases, game-pause.test.ts, editor run
- 7 new e2e checks in block 18i, driven by real keys in the game
- Six counter-checks all bite: behavior filter, collision lock, world
time, editor run, clock reset and the game clock in the browser
- Check total 1217 in README is computed (1210 + 7), CI measures it
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Changing min, max or default of a property rebuilt the slider rows of
the shader preview, but the rows stayed at 0 x 0. Only the labels were
visible until the preview was resized by hand.
- Widget.resize only lays out when the size changes. The row count
stays the same on such an edit, so the row stack kept its height and
never laid out its new children.
- syncParams now relayouts the row stack itself after the column
around it.
Tests:
- e2e 28n: a new max rebuilds the slider at 136 x 24, a click at its
right end sets level 2. Red against the old build (w 0, h 0).
- GM_STEPS=28,31 fresh: ALL PASSED, 106 checks (was 105)
- ./check.sh: 132 files, 1952 tests, exit 0
- Check sum 1210 in README, computed (1209 + 1), CI measures it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A shader could only be judged by placing it on a sprite and running
the scene. The shader tab now shows its effect next to the graph, on
the image the user picked last, without a picker to maintain.
- The preview follows the last selection that has an image: a placed
sprite with its overrides, size and tint, a sprite asset, a texture
or a frame. Clicking the shader, a node, a behavior or a scene keeps
the picture.
- Without such a selection, or when the picked image is deleted, a
built-in 64 px test image is shown. Its colour runs with u and v, a
checkerboard shows where a UV lands and the border fades for alpha.
- Each property gets a slider. The sliders belong to the preview and
never write to the project. They start at the sprite's values when
it carries this shader, otherwise at the default.
- The preview has its own clock. Hold and Restart are only enabled
when a Time node is in the graph.
- The graph | splitter | panel layout of the particles tab moves into
PreviewSplit, and both tabs use it.
- A nine-sliced frame is previewed unsliced. This is documented.
Findings:
- The slider row stayed squeezed to a few pixels when the properties
changed while the tab was hidden. The layout was triggered one level
too high. The slider check in block 28n holds this.
- The graph canvas is narrower now, 385 px at a 1280 px window, the
same as in the particles tab. Block 28b clicked at a fixed x+420 and
now uses the measured width.
Tests:
- ./check.sh: 132 files, 1952 tests (was 131 / 1941), exit 0
- npm run build: exit 0
- GM_STEPS=28,31 freshly seeded: ALL PASSED, 105 checks
- 11 new unit tests in tests/editor/shader-preview.test.ts
- 7 new e2e checks in block 28n
- Counter-probes: start values ignoring the sprite fail 1 unit test,
a preview ignoring the selection fails 2 e2e checks
- Check total 1209 in README is computed (1202 + 7), CI measures it
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Drawing an outline by hand for every frame of a sheet is slow, and the
outline mostly follows the opaque part of the image anyway. The texture
tab now traces it: one click, a corner budget, and every Frame
collision collider and tile using that frame blocks with the result.
- "Generate collision..." sits in the texture tab header and is off
while the texture has no frames.
- The dialog has Max points (default 8, 3 to 64), Solid from ... %
alpha (default 50) and All frames of the texture. A live line says
what Generate will write, and Generate stays off when nothing is
solid enough.
- traceCollision walks each island of solid pixels along the pixel
edges, then drops the least important corners until at most N are
left and no stair step remains. A slope becomes one straight edge.
- An outline never crosses itself. Where the image would force that,
the island's convex hull is taken instead.
- Crumbs under 1 % of the frame area are dropped unless they are the
only island. Holes are not reproduced.
- Existing outlines are replaced. One frame or all frames is a single
undo step.
- TextureLibrary hands out the sheet's RGBA data, and a pure function
cuts a frame's region from it.
Findings:
- The wedge in the e2e fixture gets 4 corners, not 3. Its tip is one
pixel wide in the image, and that real edge stays while corners are
still free.
Tests:
- ./check.sh: 131 files, 1941 tests, CHECK EXIT 0 (was 130 / 1931).
- 10 new unit tests in tests/core/trace-collision.test.ts, including
150 random shapes that must all be valid and within the budget.
- GM_STEPS=42, freshly seeded: ALL PASSED, 20 checks (was 16).
- Three counter-probes bite: no hull fallback, no stair threshold,
dialog ignoring the alpha threshold.
- Check sum 1202 in README is computed (1198 + 4), CI measures it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Issue #193 asked where friction, bounciness and density of a tile
live. Tiles had a fixed surface (friction 0.5, bounciness 0) and a
collider could not use the outline drawn on a texture frame (#141).
Both gaps are closed here.
- A collider has a fifth shape "Frame collision" with a Frame row.
The frame is picked like a sprite's texture and stored as the
value 'frame'.
- The shape is linked, not copied. Redrawing the outline in the
texture tab changes every collider using that frame, in the editor
and on the next play.
- The frame centre sits on the collider origin, one image pixel is
one unit. The shape turns, scales and mirrors like any other.
- Every outline ring blocks. Each ring is split into convex parts the
same way a polygon is.
- Without a frame, with a whole texture or with a frame that has no
outline, the collider is drawn red as a box and blocks nothing.
- Move, Rapier, raycast, detection, hit test, drawing and footprint
all resolve the frame. At runtime an entity looks the frame up
live in the current project.
- A tile has Friction and Bounciness next to Solid and One-way. The
rows only show when Solid is on. Defaults and mixing rules match
the collider. Density is left out because a tilemap never moves.
- Tilemap cells are grouped by surface as well as by one-way angle.
Ice and stone never merge into one rectangle, and every cell brings
its surface to Move and Rapier.
Findings:
- A tile with a collision scale below 1 is no longer flush with a
neighbour of another surface. It is inset there like at an open
side, the same as next to one-way tiles today.
- A bounce test first measured 0.84. The ball had landed on the hero
at the origin, not on the tile. On the tile it measures 0.993.
Tests:
- ./check.sh: 130 files, 1931 tests, exit 0 (was 129 / 1917).
- 14 new unit tests in tests/core/surface.test.ts. The Move tests run
against the editor run and the physics system.
- 3 new e2e checks: 40l (surface rows follow Solid), 42e (collider
has frame size, a walker climbs the slope in the frame).
- GM_STEPS=1-8,39-43 freshly seeded: ALL PASSED, 376 checks.
- Three counter-probes bite: Move ignores the tile surface (2 fail),
Rapier ignores it (1 fails), frame shape falls back to a box
(5 fail).
- Check sum 1198 is computed (1195 + 3), the full run belongs to CI.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The pen only pulled out the outgoing handle of a new point, because
the opposite handle was mirrored only if it already existed. The
first segment of every dragged point was therefore half a curve.
Beyond that bug, a point had no way to say how its handles relate.
- A vector point has an optional mode: straight, corner, smooth or
symmetric. Missing means corner. The mode is not part of the
fingerprint, because it changes no pixel, only the next drag.
- Dragging a handle follows the mode. Corner leaves the other handle
alone, smooth turns it along and keeps its length, symmetric
mirrors it exactly.
- The pen pulls out both handles mirrored and marks the point
symmetric. A plain click still sets a point without handles.
- The tab header has a "Point: ..." menu for the last clicked or set
point. That point is drawn filled. Changing its type is one undo
step. Text instead of four icons, because the UI kit has no
tooltips.
- Switching a point without handles to a curved type first grows
handles along its neighbours. Smooth and symmetric line the
handles up and keep the rough direction of the curve.
- A point inserted on a curve is smooth. Symmetric neighbours become
smooth, because the split shortens one of their handles.
- Alt-click still toggles between straight and symmetric.
Found on the way: the old Alt rounding took the point at the other
end of an open line as a neighbour, so its handles came out skewed.
Fixed and held by a unit test.
Existing points with handles now count as corner. Before, every drag
mirrored. No pixel changes, only the next drag behaves differently.
Tests:
- ./check.sh: 129 files, 1917 tests, exit 0 (before 1903)
- GM_STEPS=47, freshly seeded: ALL PASSED, 39 checks (before 32)
- Check sum 1195 in README and wiki is computed (1188 + 7), CI
measures it
- Counter-checks: pen without 'symmetric' fails 3 checks, no smooth
branch fails 1 unit test and 1 e2e check
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The snap toggle was a checkbox with the word "Snap" next to Fit, and
the vector art tab had its own "Grid" button for the same idea. Both
now share one square icon button, so snapping looks and works the
same wherever it exists.
- SnapToggle is a square toggle button with a magnet icon and no
text. It lights up blue when snapping is on, like the other toggle
buttons.
- The magnet is drawn with cubic curves instead of arcs, because the
Pixi SVG parser draws arcs as jagged edges.
- The vector art tab drops its Grid button and uses the same
SnapToggle. It still snaps to 8 px, the graph tabs to 24 px.
- SnapToggle accepts anything with setSnapping(on). The vector art
canvas method is renamed from setSnap to setSnapping for that.
- Every tab exposes the button as __gm.<tab>.snapButton(). Modules
06, 26 and 36 click through that hook instead of the label "Snap"
plus 30 px.
Tests:
- ./check.sh: 129 files, 1903 tests (was 128 / 1897)
- 3 new tests in tests/editor/snap-toggle.test.ts, 3 in the icon tests
- GM_STEPS=1-6,26,36,47 fresh: ALL PASSED, 346 checks
- GM_STEPS=47: ALL PASSED, 32 checks (was 29)
- Counter-checks: toggle not switching its target fails 2 unit
tests, the canvas ignoring the switch fails module 47
- Check total 1188 in README and wiki is computed (1184 + 4), the
full run is left to CI
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Stage 5 closes the loop that the earlier stages left open: every check so
far put the shapes into the project with mutate, because the tab that
draws them came later. Block 47f now walks the path a user walks - the +
menu, the asset panel, the tab, the picture picker - so a regression in
any of those four doors is caught by the suite instead of by you.
- The + menu offers "Vector art" among the types that only live in the
library, and the entry makes an asset that is selected and stands in
the panel under its own heading.
- A double-click on the row opens the Vector art tab on that asset,
which is what stage 3 built and no check measured until now.
- The Texture row of a sprite offers the drawing by name, sorted among
the other pictures, and picking it there makes the sprite wear it -
measured at the pixel in the scene, not at the row.
One finding: the picker listed three entries where I expected more, and
the reason is sound - a fresh fixture holds one texture and the drawing,
"None" being the third. The check names all three instead of counting,
so a lost entry says which one it lost.
Tests:
./check.sh 128 files, 1897 tests, exit 0
node tools/e2e.mjs (all modules) ALL PASSED - 1184 checks (was 1179)
GM_STEPS=47 (fresh seed) ALL PASSED - 29 checks (was 24)
Counter-checks: both hold - no generator registered fails the picker
check, and opening the tab without the asset fails the double-click
check.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Stage 4 of #129. Until now the inspector showed the rows of the asset
when a shape was selected, so there was no way to give a shape a colour,
an outline or a place in the drawing order without editing the project
file. The rows for a shape now sit where every other selection puts its
rows.
- SHAPES lists every shape of the asset, topmost row drawn last, the
same way a layer list reads. Selecting the asset itself shows the same
list below its own rows, with no shape selected.
- Each row paints its shape with the commands the rasterizer uses
(shapeDrawing plus paintDrawing) into a 22 px swatch, the whole canvas
scaled in, so the row also says where on the canvas the shape sits.
- The four order buttons from the issue (forward, to front, backward, to
back) sit in two rows of two, and a row can be dragged to another
place with a marker line. They are disabled when there is nothing to
move.
- VECTOR SHAPE carries name, fill, opacity and an outline checkbox, the
checkbox adding and removing the stroke instead of hiding it; line
colour and width appear with it. A dragged colour slider is one undo
step, the style rows going through previewingHandlers like every other
row.
- A line width of 0 is no stroke, which the command rejects, so the row
clamps at 0.1.
Findings:
- locate('Outline') aims beside the control, because it gives the centre
of the label text and a wider label pushes a fixed offset out of the
field. __gm.inspectorField(label) knows the centre of the control.
- A click into a text field sets the cursor and selects nothing, so a
typed hex landed appended to the old one and parseHex returned null
without anything failing - typeText only checks that the text is
contained. A Ctrl+A goes first now.
- Four buttons side by side cut "Backward" to "Backw...", which only the
screenshot showed. Two rows of two now, as in the tilemap panel.
Tests: ./check.sh 128 files, 1897 tests (was 127/1883). Full e2e suite
locally instead of only CI because the change sits in the inspector and
touches every selection: ALL PASSED - 1179 checks (was 1172), module 47
at 24 checks (was 17). Three counter-checks hold: not reversing the list
fails 1 unit test and 2 e2e checks, dropping the gap correction when
dropping a row fails 2 unit tests and the drag check, and a constant
signature kills module 47 because the outline rows never appear.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Dragging a point only redrew once the hand stopped moving, which the
user reported after stage 3 and which measures as a real backlog, not a
feeling: every pointer move wrote the model and fired state.preview(),
and a project event rebuilds the panels, the run in the editor and the
picture the drawing is rasterised into. A mouse reports about 125 times
a second while the screen takes 60, so the queue grew instead of the
drawing moving.
- Measured with a throwaway e2e probe sending 120 moves at the 8 ms of
a real mouse, against a growing scene. Per move event: 10 -> 7 ms
with an empty scene, 19 -> 4 ms at 40 objects, 36 -> 3 ms at 120.
The 120 moves took 4173 ms before and 960 ms after, which is the
time they were supposed to take.
- New onFrame(key, fn) in src/ui/render.ts collects such work per key
and runs it in the ticker before app.render(), because afterwards it
would be one frame late in the picture. The rule lives in ui/ rather
than in the canvas so a second caller gets it for free.
- VectorArtCanvas only queues in pointermove now, and cancels its slot
on pointer up, where the command writes the final state anyway.
During the gesture the drag's own copy of the rings is the truth and
the model is never read back, so nothing is lost by the delay.
The same cost sits in the scene viewport, the texture tab and the graph,
which all call preview() from their move handler. They are untouched:
that is outside the reported bug.
Tests: check.sh 127 files, 1883 tests, exit 0 (was 1878). Full e2e
suite locally instead of CI only because the change sits in the render
loop: ALL PASSED - 1172 checks, the sum unchanged - a timing check in
the browser would flutter under CI load. Five new unit tests in
tests/ui/render.test.ts. Two counter-checks hold: running the work
after the frame fails one unit test, and taking the coalescing out of
the canvas puts the measurement back at 36 ms and 4153 ms.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Stages 1 and 2 gave the asset a model and a picture, but the only way
to put a shape into it was a test calling mutate. The tab closes that
gap: what you draw there is what the sprite in the scene carries, with
no extra step, because the fingerprint changes and the picture registry
of #185 redraws.
- The tab has a header with Select, Pen, Grid and Fit, a chequerboard
behind the canvas and the canvas itself as a frame. It paints with
the same commands as the rasterizer, paintDrawing being exported
from viewport/vectorArtPicture.ts for it, so the tab cannot drift
away from the picture.
- Pen sets points on a click and pulls the handles out on a drag, both
of them mirrored; a click on the first point closes the ring and Esc
ends an open line.
- Select drags a point, a handle or a whole shape, a click on an edge
puts a point there, a double click takes one away, and Alt turns a
corner round and back. Delete removes the selected shape.
- The rules grew inside polygonEdit.ts instead of a second module, as
the plan says, so a collider polygon and a frame outline get the
same behaviour where it applies.
- A point on a curved edge splits the curve by de Casteljau instead of
cutting it: both halves together draw exactly what was there before.
- A curved edge is walked instead of measured over its chord, or a
click on the bow of a curve would grab nothing; the same walk carries
the test for the inside of a ring.
- One gesture is one undo step. The preview writes the model directly
and the old state is put back on release before the command runs,
which is the pattern the frame outlines of #141 already use.
- state.ts gained a selection kind "shape". The inspector shows the
rows of the asset for it, the shape list with colour, opacity and
stroke being stage 4.
One counter-check was no counter-check: disabling the pen's closing
tolerance by multiplying it with 0 left the run green, and rightly so,
because the closing click lands on exactly the screen coordinate point
0 came from, so the distance is 0 and <= 0 is true. Only an
unsatisfiable condition really switched it off, and then 2 checks fail.
A second trap on the way: a false && in front of the guard breaks the
TS narrowing, npm run build bails out, and two runs went against the
old bundle.
Tests: check.sh 127 files, 1878 tests, EXIT 0 (was 126 / 1860).
Full e2e suite ALL PASSED - 1172 checks, module 47 alone 17 (was 10).
18 new unit tests in tests/editor/ring-edit.test.ts and 7 new e2e
checks in blocks 47c and 47d. Two counter-checks hold: no de
Casteljau fails 1 unit test, measuring a curve over its chord fails
another. Originals checked back with cmp and rebuilt.
The corner tables are now derived from rmmz_core.js (Tilemap._addAutotile,
FLOOR_AUTOTILE_TABLE, WALL_AUTOTILE_TABLE): the fill quadrants are taken
rotated by half a tile so that neighbouring tiles meet with the quarters that
sit next to each other on the sheet, and the inner corners come from the upper
right tile of the block, not the upper left one. A test pins the model against
both MZ tables, generated from rmmz_core.js rather than typed out.
The animation check in e2e module 39 read its four pixels one by one and could
straddle a frame change; step and pixels are now read in a single call.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Stop animation gets a blend (s) port that fades the animation back to what
lies underneath. Play animation gets blend out (s) for Once (reset) and a
restart port that starts a running, paused or fading animation from frame 0.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The Animation tab shows the root asset over the timeline, with every row's value at the
playhead written onto a copy of it – the sprite, text or container placed at the origin as a
scene would place it, a scene as itself. Rows reach the root through that placed object and its
children through the object's instance edits, the route a placed container's content takes,
so the ids match what the runtime gives them. The runtime player and the preview evaluate a row
through one function (trackWriteAt), relative rows included; past the end of a once-reset pass
the preview shows the starting values, as the player would. Play, pause and the ruler drive the
preview through the timeline's playhead; a drag pans, the wheel zooms, Centre frames it. The
document is never touched and undo never hears of scrubbing.
On animation finished no longer describes itself as hearing "a sprite of the owner".
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Play, Pause and Stop animation take the animation on a port instead of a
fixed setting, fed by the new Animation literal or a list item tagged
`$animation`. Playing an animation already running keeps its frame but
counts it as started last, so turning back to a walk that never stopped
shows that walk. The actor demo walks through one Play animation over
`ItemAt(walk, facing)` again and stops every animation to stand.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Part (a) of the animation rework: model, commands, saving, runtime and nodes.
- AnimationAsset holds a root (sprite, text, container or scene) and rows; a row keys one
property of the root or of an object inside it, keys sit on whole frames.
- The last key decides the length (its frame counts as a frame of its own). The playhead runs
between frames, so numbers and colors blend every tick even at 10 fps; everything else holds.
- Playback gains `once-reset`, which puts back what was there before the start. A row can be
relative, adding to where its target stood.
- Play / Pause / Stop animation act on an object; each instance plays on its own, the later
start wins on a shared property, and a behavior writing the same property still writes last.
- A sprite no longer wears an animation through `texture`. "Create animation from texture"
builds a sprite plus a texture row keyed frame by frame instead.
- The Animation tab shows a placeholder until the timeline editor (part b) lands.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Refactoring round two: the particle and shader compilers share emitGraph.ts (cycle detection,
duplicate names, emit order) and keep only their rules. FontLibrary and TextureLibrary sit on
FileLibrary (base URL, loading/failed bookkeeping, listeners); SoundLibrary keeps its own
contract. The three Create*Command share ImportFileCommand, the three renames share
RenameCommand - class names stay. bandBounds() in framing.ts and portNameField() in
portSection.ts replace in-file clones, and three comments that told history now state the rule.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The fill of a sliced frame defaulted to `Stretch`. It is `Repeat` now, and the Fill dropdown lists
`Repeat` first.
The saved document keeps writing only the fill that differs from the default, so the key it
carries is now `stretch`, and a frame without it repeats. A frame saved before with the key
absent and meaning stretch would therefore tile; none of the stored projects has one - both sliced
frames on the server carry `fill: "repeat"` explicitly, so they draw as before.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A sliced frame drew its borders one source pixel to one sprite unit. Pixel-art sheets are small:
a 16px corner on a 400-unit button is a thin line, and the only way around it was a larger image.
The texture now carries `Nine-slice scale` (default 1), next to `Filter`. It sets how many sprite
units one border pixel takes, for every sliced frame of that texture. The UVs stay as they are -
a corner shows the same pixels, only larger or smaller. When the sprite is too small for both
borders they are still scaled down together, now starting from the scaled size. With `Repeat`
the tile size scales too, otherwise a doubled border would sit beside a pattern of the old size.
The value is a schema row, so inspector field, saving and undo come without their own code.
Anything that is not a size above 0 reads as 1, and documents without it draw as before.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Refactoring round one: HttpFontStore/HttpSoundStore/HttpTextureStore collapse into a generic
HttpFileStore over a FileStore contract; fontImport/soundImport/textureImport share assetImport
with an ImportKind per sort; ImagePicker/FontPicker/SoundPicker sit on FilePicker and describe
only their row. The group/comment drag logic leaves GraphCanvas for annotationDrag.ts (with its
own unit test), declaredRows.ts replaces the duplicated row build in particles.ts and shaders.ts,
and dead code in font/sound/compile/emission/transform/actions is gone. README: asset list,
check count 958, the two-job CI, the Scenes wiki page.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The workflow ran everything in one job: check.sh, then build, then the e2e suite and the smokes.
The runner has two job slots and four cores, so the second slot lay idle for the whole run, and a
lint error was reported only after the full suite had passed in front of it - six minutes instead
of one.
Now `gate` and `suite` are two jobs without `needs:`. They start together, both have to pass.
The price is contention: while the gate runs, vitest and chromium share four cores, and the suite
measures text widths and frame counts, which a loaded machine reports differently. The gate
therefore caps vitest at two workers via GM_TEST_WORKERS, so two cores stay free for the browser
over the whole overlap. Locally the variable is unset and nothing changes.
Measured before the push: the cap costs vitest 4.4s (16.6s -> 21.0s), check.sh exits 0 with it,
build ok. Whether the split is worth it is a question for the runner - the expected net gain is
about 50s, and the acceptance is a measurement over at least two runs.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Fit measured the nodes alone: a group drawn around them was cut off, and a graph holding nothing
but a comment framed the empty origin. It now frames both sorts together.
The rubber band ignored boxes entirely. It catches them now, into the *same* selection as the
nodes — `nodeIds` and `annotationIds` side by side — so one drag moves all of it, one Delete
removes all of it, and one undo takes it back. A box counts only when the band holds all of it,
where a node counts on touching: a group wraps the nodes it holds and therefore overlaps every
band drawn over any of them, and since it drags those nodes along, catching it by accident would
be felt at once.
A node inside a selected group is moved once, not twice — `travellers()` collects everything one
gesture carries and lets each thing appear in it a single time.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
TextureFrame carries optional `border` (left/right/top/bottom) and
`fill` (stretch | repeat); absent keys mean "not sliced", so no format
bump and undo restores the plain frame instead of four zeroes.
The sliced sprite builds its own geometry instead of the shared
UNIT_QUAD: a 4x4 grid, and for `repeat` one quad per tile carrying the
frame cell's real UVs -- tiling in the geometry, not in the sampler, so
a frame out of a sheet cannot pull its neighbour in. Above 64 tiles per
axis it stretches, to bound the buffer.
A sprite narrower than left+right scales both borders down together
until the middle is exactly 0, so the corners meet at a seam and never
overlap.
The texture editor gets four draggable border lines plus the same four
numbers in the inspector. Hit order is resize handles, then the lines,
then the frame body -- handleAt reports 'move' anywhere inside a frame,
so lines placed after it were unreachable.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The graph could hold any number of nodes and said nothing about which of them
belonged together. Groups and comments are two separate things, as decided in
the issue: a group is a titled box that carries the nodes it encloses, a
comment is free text that carries nothing.
Both live as optional arrays on Graph, not as registry nodes. A comment that
were a real node would run through the interpreter, show up in the drop
palettes and be compiled into a shader — the wrong place for a piece of text.
As arrays on Graph they exist in all four graph kinds at once, and a document
without them means exactly "no groups", so no format bump.
Membership is computed when the box is grabbed, never stored: the center of a
node inside the box travels with it, and a node dragged out is simply out. A
box inside a box travels with the outer one, its own nodes included. A group
is grabbed by its title bar only — its body stays transparent to the pointer,
or a rubber band could never be drawn across the nodes it holds. Deleting a
box deletes the box; the nodes stay where they are, because a box that
silently took ten nodes with it would be the most expensive surprise in the
feature.
The color is a free picker, and the title color follows from it: relative
luminance per WCAG, threshold at 0.179 where the two contrast ratios meet —
not 0.5, which would pick white on mid grey where black reads better.
Resizing snaps the far edge to the grid, not the width, so the corner that is
not being dragged stays put. The minimum size rises in whole steps for that
reason: 80 is no multiple of 24, so a box squeezed to the stop would have sat
off-grid in exactly the mode meant to keep it on.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Set state and State branch derived their ports from the graph, so a machine
that came out of a variable or a list had no ports at all: nothing to set,
nowhere to branch. It could be passed around but not operated.
stateByName() resolves id first, then name; a name two states carry answers
with nothing, the same rule transitionTo already follows for two transitions
of one name — without something in the graph that decides between them, any
pick would be a guess.
Set state by name takes the machine and a text, and has a second exec output
not found, so a typo is not swallowed in silence. State branch gains a
derived else that fires whenever no state output matches — no state set, a
state of another machine, or a machine that arrives as a value and therefore
has no state outputs at all. A flow that enters State branch now always
leaves it somewhere.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The suite spent 88% of its step time asleep: 564 s of steps, 496 s of
them in sleep(n) - fixed spans estimated by hand and then copied from
step to step. That is why it was slow, and why it flickered.
The signal is afterFrames(count, timeout) in ui/render.ts, exposed as
__gm.afterFrames(). It wakes the loop itself, because an editor that
draws nothing would never redeem a promise of a frame, and it gives up
after a timeout instead of hanging the run. settle() in the harness
waits two drawn frames (~32 ms) instead of 150-300 ms and falls back to
sleep(150) when the hook is missing (an old build): silently not
waiting would make every later check a coin toss.
Every action goes through it now - click, doubleClick, wheel, drag,
dragAsset, press, typeText, select, mutate, undo, redo - and with that
about 550 sleep() calls behind those actions became redundant, helpers
that are nothing but a mutate in a coat included. What a frame cannot
answer got its own condition instead: waitUntil(expr), play()/stop()
waiting on __gm.state.mode rather than on 300 ms, saved() for the
autosave (the two hand-written polling loops sampled at 300 ms for
something that arrives after a second), and showTab() as a real tool -
47 places called evaluate("__gm.showTab(...)") raw, and 24 of them
waited for nothing at all and read the old panel.
564 s -> 243 s of step time, the waiting share 88% -> 76%. Three kinds
of wait were kept, and each one bit when it was taken away: loading
bytes (textures, fonts), game time that a repaint cannot stand in for
(time scale, shader and particle clocks, the live values a running
graph carries), and the inertia the scroll step measures on purpose.
Two things the new speed uncovered, both real: 25-animation read the
frame menu unfiltered and had frozen an incomplete list (the CI failure
on c990dbc), and 33-render-on-change measured idleness while the
autosave of the step before was still painting - it waits for
saveStatus to leave dirty/saving now, so it measures that nothing
happens any more instead of that it waited long enough.
#63: a shader Property node named "width" quietly took over the sprite
row of the same name. isSpriteProp lives in PropertySchema now and is
derived from FULL_SCHEMAS.sprite instead of being a second list that
drifts. isValidPropertyName rejects those ten names, and the compiler
reports it at the node as its own problem: "width" is a sprite
property, told apart from "not a word" and from a duplicate.
#64: Divide emitted (a / b) and handed NaN to the driver. It emits
divide(a, b) now, with the guard in the prologue next to straight(),
scalar and per channel: zero divided by zero is zero. That was already
the house rule in the behavior and particle graphs - only the shader
had never been told. Clamp comes along as a shader node for the same
reason: the behavior catalog has had it all along.
CI found the gap the hard way: with every kind of asset in the project
the new scene sits below the panel, and the right click for "Set as
start scene" landed somewhere under the list instead of on the row.
locate() only asked whether a text was visible, and a masked row still
is - it is merely clipped away.
locateAll and overlayTexts now walk the tree together (eachText) and
carry the clip of every ancestor, measured on the widget that owns the
mask: Pixi v8 hands a Graphics set as a mask to the mask effect and
reports empty bounds for it, so asking the mask itself declares every
masked text in the editor missing. Two hooks with two notions of
"visible" was the second half of the same bug.
The panel also scrolls the selected row into view now, the way the
hierarchy has always done - an asset selected elsewhere has to be
findable in the list, test or no test. And step 21 learned that scene
is a property kind.