fix: hide disabled room names

Issue: #203
User-Visible: yes
This commit is contained in:
Sergey Matyunin
2026-08-19 18:47:33 +03:00
parent 84e62dcd0f
commit 1290927f10
16 changed files with 348 additions and 175 deletions
+50
View File
@@ -404,6 +404,56 @@ export const MUTANTS = [
replace: ' if (!replacingRemoved && prevPos && prevPos.s === targetSpaceId && !roomChanged) {',
}],
},
{
id: 'hidden-room-names-full-svg-fallback',
guard: 'node demo/smoke_hide_room_names.mjs',
because: 'show_names:false must remove every permanent label from the full flat renderer; '
+ 'the smoke must reject the legacy centred SVG substitute independently of compact and iso',
patches: [{
file: 'src/houseplan-card.ts',
find: " ${this._renderOpeningTunnelFills(space, glowBase, 'glow-base')}\n"
+ ' ${glowLayerVisible ? this._renderGlowLayer(space, disp) : nothing}',
replace: " ${this._renderOpeningTunnelFills(space, glowBase, 'glow-base')}\n"
+ ' ${!space.bg && !disp.showNames && !this._markup ? svg`<g class="room-svg-labels" pointer-events="none">${space.rooms.map((room) => {\n'
+ ' const center = this._roomCenter(room);\n'
+ ' return svg`<text class="rlabel" data-hp="room-label" data-id=${room.id || nothing}\n'
+ ' data-area=${room.area || nothing} x=${center[0]} y=${center[1]}>${room.name}</text>`;\n'
+ ' })}</g>` : nothing}\n'
+ ' ${glowLayerVisible ? this._renderGlowLayer(space, disp) : nothing}',
}],
},
{
id: 'hidden-room-names-compact-svg-fallback',
guard: 'node demo/smoke_hide_room_names.mjs',
because: 'the compact card is an independent renderer and must not replace a disabled HTML '
+ 'room card with the old SVG name even when the full card is correct',
patches: [{
file: 'src/space-render.ts',
find: ' spaceModels, defaultPositions, markerPos, labelPos, spaceFrame, iconCqw, NORM_W,',
replace: ' spaceModels, roomCenter, defaultPositions, markerPos, labelPos, spaceFrame, iconCqw, NORM_W,',
}, {
file: 'src/space-render.ts',
find: ' ${passageGlowTunnels}\n ${wallUnion',
replace: ' ${passageGlowTunnels}\n'
+ ' ${!space.bg && !disp.showNames ? svg`<g class="room-svg-labels" pointer-events="none">${space.rooms.map((room) => {\n'
+ ' const center = roomCenter(room);\n'
+ ' return svg`<text class="rlabel" data-hp="room-label" data-id=${room.id || nothing}\n'
+ ' data-area=${room.area || nothing} x=${center[0]} y=${center[1]}>${room.name}</text>`;\n'
+ ' })}</g>` : nothing}\n'
+ ' ${wallUnion',
}],
},
{
id: 'hidden-room-names-iso-override',
guard: 'node demo/smoke_hide_room_names.mjs',
because: 'hidden isometric View must obey the same show_names:false contract instead of '
+ 'forcing an HTML room card solely because the space has no backdrop',
patches: [{
file: 'src/houseplan-card.ts',
find: ' ${disp.showNames || this._markup\n',
replace: ' ${disp.showNames || (iso && !space.bg) || this._markup\n',
}],
},
{
id: 'plan-room-area-icon-hidden',
guard: 'node demo/smoke_room_link.mjs',