From 81c5b2d22e1eac45e23e967d8fb25a3e2e71cec9 Mon Sep 17 00:00:00 2001 From: Wassim SAMAD Date: Sat, 27 Jun 2026 20:49:33 -0400 Subject: [PATCH] fix(nodes): match item floorplan sprite rotation to its footprint box MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The footprint polygon uses `rotateVec` (R(-angle)) but the sprite was drawn via SVG `rotate(+angle)`, so image and box counter-rotated and diverged by 2x the item's rotation in the 2D floorplan. Negate the image rotation so the sprite tracks its box (and the 3D orientation). Scoped to items — the only emitter of the `image` floorplan geometry kind. Co-Authored-By: Claude Opus 4.8 (1M context) --- packages/nodes/src/item/floorplan.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/nodes/src/item/floorplan.ts b/packages/nodes/src/item/floorplan.ts index 93ab7c9c..535ace14 100644 --- a/packages/nodes/src/item/floorplan.ts +++ b/packages/nodes/src/item/floorplan.ts @@ -212,7 +212,11 @@ export function buildItemFloorplan(node: ItemNode, ctx: GeometryContext): Floorp center: [cx, cy], width, height: depth, - rotation: transform.rotation, + // `rotateVec` (the footprint polygon) applies R(-angle), but the renderer + // draws the image with SVG `rotate(+deg)` = R(+angle). Negate so the + // sprite rotates the same way as its footprint box (and 3D); otherwise the + // two counter-rotate and diverge by 2x the item's rotation. + rotation: -transform.rotation, }) } // Move handle — orange dot at the item center. Only when selected and not