feat(viewer): export getWallHideState - #576
Merged
Merged
Conversation
…ayers Hosts that render overlays inside `<Viewer>`'s children seam had no way to match wall-cutout visibility: they either re-derived the camera facing dot-product (which drifts from the source of truth) or inferred state from the assigned material variant's `transparent` flag. The predicate is already pure, so export it as-is and give `wallMode` a named `WallMode` type instead of a bare `string`. Closes #572
Aymericr
force-pushed
the
feat/export-wall-hide-state
branch
from
August 4, 2026 16:42
32bd509 to
4c1f8ab
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #572.
What
getWallHideState(wallNode, wallMesh, wallMode, cameraDir)is now exported from@pascal-app/viewer, along with theWallModetype it takes.Why
@esteban685 asked for this in #572: a host rendering its own layers inside
<Viewer>'s children seam has no way to match wall-cutout visibility today. The two available workarounds are both bad:getWorldDirection(v).dot(cameraDir) < 0facing test in host code — it silently drifts the moment the viewer's rule changestransparentflag — fragile, and it conflatestranslucentmode with a hidden wallThe predicate was already pure: it takes every input explicitly and touches no module state beyond a scratch
Vector3. So this is an export, not a refactor —WallCutoutcalls the same function on the same line it did before.Changes
packages/viewer/src/systems/wall/wall-cutout.tsx—export function getWallHideState, plus a JSDoc block recording why it is publicpackages/viewer/src/store/use-viewer.ts— extractexport type WallMode = 'up' | 'cutaway' | 'down' | 'translucent'so the signature names its mode instead of accepting anystring.WALL_MODESalready existed as the runtime counterpart; the store fields now reference the named type.packages/viewer/src/index.ts— re-exportgetWallHideStateandtype WallModepackages/viewer/src/systems/wall/wall-hide-state.test.ts— 5 cases pinning the semantics that are now public API:upalways shows,downalways hides,cutawayhides the near exterior face and both-sides-interior walls, and keeps both-sides-exterior walls visible from either directionVerification
bun test packages/viewer/src/systems/wall/→ 24 pass, 0 failbun run check→ 1582 files cleanbun run check-types→ 9/9 tasks passNo behavior change: same predicate, same call site, wider visibility.
Note
Low Risk
Export-only surface area with typed signatures and new unit tests; wall rendering behavior is unchanged.
Overview
Public API for wall cutaway visibility so hosts that render custom layers inside
<Viewer>can hide or show geometry the same wayWallCutoutdoes, without copying the camera-facing test or inferring hide state from material transparency.getWallHideStateis exported fromwall-cutout(unchanged logic; JSDoc explains the intent). ThewallModeargument is typed as a new exportedWallModeunion ('up' | 'cutaway' | 'down' | 'translucent') on the viewer store and the helper. Both symbols are re-exported from@pascal-app/viewer.Tests in
wall-hide-state.test.tslock inup/downoverrides andcutawaybehavior for interior/exterior combinations.Reviewed by Cursor Bugbot for commit 4c1f8ab. Bugbot is set up for automated code reviews on this repo. Configure here.