Vector art points have four types and the pen draws whole curves (#195)
game-maker / gate (push) Successful in 2m10s
game-maker / suite (push) Successful in 7m29s

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>
This commit is contained in:
adminandClaude Opus 5 committed 2026-09-21 06:51:35 +02:00
1 parent 90627ccf47
commit 3ff7e91dbf
11 files changed
+487 -65

No files matched your search

+11 -4
View File
@@ -121,6 +121,12 @@ describe('the revision', () => {
f.stack.execute(new RenameVectorShapeCommand(f.assetId, add.shapeId, 'Body'));
expect(vectorArtRevision(f.art())).toBe(first);
// A point's type only says what the next drag does to its handles (#195).
const typed = square();
typed.points[0] = { ...typed.points[0]!, mode: 'smooth' };
f.stack.execute(new SetVectorShapeRingsCommand(f.assetId, add.shapeId, [typed]));
expect(vectorArtRevision(f.art())).toBe(first);
f.stack.execute(new SetVectorShapeStyleCommand(f.assetId, add.shapeId, { fill: 0xff0000 }));
const coloured = vectorArtRevision(f.art());
expect(coloured).not.toBe(first);
@@ -316,8 +322,8 @@ describe('what a project file may say', () => {
closed: true,
points: [
{ x: 10, y: 10, out: { x: 4, y: 0 } },
{ x: 90, y: 10 },
{ x: 50, y: 80 },
{ x: 90, y: 10, in: { x: -3, y: 0 }, out: { x: 6, y: 0 }, mode: 'smooth' },
{ x: 50, y: 80, in: { x: -2, y: 1 }, out: { x: 2, y: -1 }, mode: 'symmetric' },
],
},
{
@@ -350,7 +356,7 @@ describe('what a project file may say', () => {
{
closed: true,
points: [
{ x: 10, y: 10, in: { x: 'left', y: 2 }, out: { x: 1, y: 2 } },
{ x: 10, y: 10, in: { x: 'left', y: 2 }, out: { x: 1, y: 2 }, mode: 'wobbly' },
{ x: 'far', y: 10 },
{ x: 30, y: 30 },
{ x: 50 },
@@ -370,7 +376,8 @@ describe('what a project file may say', () => {
const loaded = f.art(roundTrip(f.project));
expect(loaded.shapes).toHaveLength(1);
const shape = loaded.shapes[0]!;
// The broken handle falls away and leaves a corner; the broken points fall away entirely.
// The broken handle falls away and leaves a corner, and so does a point type nobody knows (#195);
// the broken points fall away entirely.
expect(shape.rings[0]!.points).toEqual([
{ x: 10, y: 10, out: { x: 1, y: 2 } },
{ x: 30, y: 30 },