fix: alignment guides follow the live gesture again (#521)

#451 moved every editor gesture onto the live painter, and the guides stayed
behind in the settled scene. While a gesture runs, the settled scene is not
re-rendered at all, so the guides did not follow the marker in the device
editor, the shape in the backdrop editor, or the cursor while a contour is
drawn in the plan editor. Measured with real pointer events on the demo stand
against `origin/dev`, after waiting for the editor chrome to settle: three
gestures, each exactly on another object's axis, 0 settled render cycles,
`.alignline` 0 and no `.alignguides` group in all three.

The report called it two breaks. It is one — the layer — plus one thing that
would have broken the repair: `_alignPoint` read `_pos`, which during a live
gesture answers from the snapshot of the last settled render. Over one drag:
live 254.17 → 220.83 while `_pos` stayed at 254.17, eight grid steps behind,
so a restored layer would have drawn the guide at the marker's old place.

The live template now paints the guides in all three modes (the device editor
had no template at all — `paintDevice` only moves the marker element), and
`_alignPoint` takes the live position. The settled copy of
`.hp-editor-only-layer` is made transparent for the duration of any editor
gesture, not only in plan mode: two guides, one of them stale, is what the
user would otherwise see when an unrelated settled render lands mid-gesture.
`_renderAlignGuides` on the card becomes soft — a gesture that starts while
the editor runtime is still loading must cost nothing, and an exception inside
a `requestAnimationFrame` paint would take the whole gesture with it.

The witness is rewritten around the defect that hid this for two stable
releases: the old smoke assigned `_deviceDrag`/`_decorDraft` wholesale, and an
assignment with `oldValue == null` does not route to the live path — it
verified a state a real gesture never reaches. Every scenario now drives real
`PointerEvent`s, waits for silence first (the `_hdrH` settling window right
after entering a mode hands out settled frames that make even the broken code
draw a guide), and asserts zero settled cycles during the movements plus
exactly one `.alignguides` group. #400's exclusion is checked without touching
the drag state: the dragged marker must simply be absent from the candidates.
On `origin/dev` the smoke fails on nine of its facts; a witness that stays
green before the fix was the actual bug here.

Mutants: `live-editor-devices-drops-align-guides`,
`live-editor-decor-drops-align-guides`, `live-editor-plan-drops-align-guides`,
`align-point-reads-frozen-snapshot` — one per AC, all guarded by the smoke.
`test/smoke-harness-contract.test.mjs` pins that the smoke cannot go back to
fabricating gesture state.

Issue: #521
User-Visible: yes
This commit is contained in:
Claude
2026-09-10 22:20:18 +03:00
parent fa7ac02c0f
commit 53585b451b
51 changed files with 699 additions and 407 deletions
+6
View File
@@ -2,6 +2,12 @@
## Unreleased
- Alignment guides follow the object again while you drag it: the marker in the
device editor, the shape and the cursor in the backdrop and plan editors. The
dashed line and its anchor dot appear the moment the object lines up with
another one, instead of after the gesture is over
([#521](https://github.com/Matysh/houseplan-card/issues/521)).
## v1.74.0-beta.1 — 2026-09-10
- The summary panel no longer freezes the first frame on a large plan, and it
+6
View File
@@ -8,6 +8,12 @@
## Не выпущено
- Направляющие выравнивания снова идут за объектом во время жеста: за значком
в редакторе устройств, за фигурой и курсором в подложке и в плане. Пунктирная
линия и точка-якорь появляются в тот момент, когда объект встаёт на одну ось
с другим, а не после того, как жест закончился
([#521](https://github.com/Matysh/houseplan-card/issues/521)).
## v1.74.0-beta.1 — 2026-09-10
- Сводная панель больше не подвешивает первый кадр на большом плане и не пишет