fix: keep flipped openings on wall centerline

Issue: #250
User-Visible: yes
This commit is contained in:
Sergey Matyunin
2026-08-23 01:59:26 +03:00
parent 2534916c94
commit 0eb9ffe480
24 changed files with 341 additions and 334 deletions
+9 -30
View File
@@ -1658,39 +1658,18 @@ export const MUTANTS = [
}],
},
{
id: 'opening-symbol-default-uses-room-face',
id: 'opening-symbol-flip-restores-edge-offset',
guard: 'npx tsc -p tsconfig.test.json && node scripts/fix-test-build.mjs '
+ '&& node --test test/opening-symbol-placement.test.mjs',
because: 'dropping the explicit default-centre guard makes every ordinary door/window '
+ 'follow the resolved physical face again, restoring issue #242',
+ '&& node --test test/opening-symbol-placement.test.mjs '
+ 'test/opening-symbol.test.mjs test/iso-openings.test.mjs',
because: 'a saved flip changes only opening direction; restoring the released #242 '
+ 'door/window edge translation moves the symbol off the wall centreline (#250)',
patches: [{
file: 'src/opening-symbol-placement.ts',
find: " if (!flipV || type === 'gate' || type === 'passage') return { ox: 0, oy: 0 };",
replace: " if (type === 'gate' || type === 'passage') return { ox: 0, oy: 0 };",
}],
},
{
id: 'opening-symbol-partition-follows-endpoints',
guard: 'npx tsc -p tsconfig.test.json && node scripts/fix-test-build.mjs '
+ '&& node --test test/opening-symbol-placement.test.mjs',
because: 'using the signed resolver offset instead of its depth makes the chosen edge '
+ 'depend on room ownership or reversed host direction instead of the local opening axis',
patches: [{
file: 'src/opening-symbol-placement.ts',
find: ' const half = Math.hypot(face.ox, face.oy);',
replace: ' const half = face.oy || face.ox;',
}],
},
{
id: 'opening-gate-flip-translates-leaves',
guard: 'npx tsc -p tsconfig.test.json && node scripts/fix-test-build.mjs '
+ '&& node --test test/opening-symbol-placement.test.mjs',
because: 'removing the gate exemption turns flip_v back into a wall-face translation; '
+ 'the leaves must stay centred while only their ten-degree turn changes direction',
patches: [{
file: 'src/opening-symbol-placement.ts',
find: " if (!flipV || type === 'gate' || type === 'passage') return { ox: 0, oy: 0 };",
replace: " if (!flipV || type === 'passage') return { ox: 0, oy: 0 };",
find: ' return { ox: 0, oy: 0 };',
replace: " if (_flipV && (_type === 'door' || _type === 'window'))\n"
+ " return { ox: 0, oy: Math.hypot(_face.ox, _face.oy) };\n"
+ ' return { ox: 0, oy: 0 };',
}],
},
{