Skip to content

Commit 84c9722

Browse files
ryan-williamsclaude
andcommitted
Controls: hide Surface section in heatmap / diff modes
The `Surface` drawer section drives `IsosurfaceRenderer` / `VolumeRenderer`; in heatmap mode (the default) and signed-diff mode (`s=d`) the render branch is `HeatmapRenderer`, which ignores `isoLevel`. The section was permanently visible as dead UI — sliding Iso or Opacity had no effect on the rendered scene. - `Controls.tsx`: gate the `Surface` `DrawerSection` on `!useHeatmap && !isDiff`. New `isDiff?: boolean` prop, plumbed from `App.tsx` as `srcRole === 'diff'`. - `e2e/elvis.spec.ts:waitForLoad`: previously probed `Iso: \d+` text (which lived inside Surface) as the "data parsed" signal. Switched to `window.__elvisCameraReady`, the explicit camera-mounted flag CameraController already sets after a frame post-render. Robust to further section-visibility changes. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 6d3d8b8 commit 84c9722

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

pkgs/core/src/components/Controls.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ interface ControlsProps {
7777
highlightElement?: string | null
7878
/** Called when the user hovers/unhovers an element pill in the legend */
7979
onHighlightElementChange?: (el: string | null) => void
80+
/** Whether the current view is a signed diff (`s=d`). Hides the Surface
81+
* section since Iso/Opacity don't apply to the heatmap-only diff render. */
82+
isDiff?: boolean
8083
/** Heatmap-mode params (only meaningful when heatmap mode is on). */
8184
useHeatmap?: boolean
8285
onUseHeatmapChange?: (v: boolean) => void
@@ -165,6 +168,7 @@ export function Controls({
165168
onTileFadeChange,
166169
highlightElement: _highlightElement,
167170
onHighlightElementChange,
171+
isDiff,
168172
useHeatmap,
169173
onUseHeatmapChange,
170174
heatmapOpacity = 0.4,
@@ -281,6 +285,7 @@ export function Controls({
281285
</div>
282286
)}
283287

288+
{!useHeatmap && !isDiff && (
284289
<DrawerSection id="surface" title="Surface" icon={<Atom size={ICON_SIZE} />} accent={ACCENT.surface} defaultOpen>
285290
<div className={styles.controlLabel}>
286291
<div className={styles.sliderHeader}>
@@ -347,6 +352,7 @@ export function Controls({
347352
/>
348353
</div>
349354
</DrawerSection>
355+
)}
350356

351357
{onUseHeatmapChange && (
352358
<DrawerSection id="heatmap" title="Heatmap" icon={<Flame size={ICON_SIZE} />} accent={ACCENT.heatmap} defaultOpen={false}>

pkgs/static/e2e/elvis.spec.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,14 @@ async function waitForLoad(page: Page) {
5151
// The filename appears in the (default-closed) Cached Files drawer as well as
5252
// the always-visible Controls panel title; `.last()` picks the visible one.
5353
await expect(page.getByText('mp-1000020.json.gz').last()).toBeVisible({ timeout: 15000 })
54-
// Iso info shows after grid data is parsed and density quantiles computed.
55-
// Replaces the previous `Slice: X / 31` probe, which no longer renders since
56-
// slice display defaults off (a40b788).
57-
await expect(page.getByText(/Iso: \d+/)).toBeVisible({ timeout: 10000 })
54+
// CameraController sets `__elvisCameraReady` only after the renderer is
55+
// mounted (which requires parsed volume data). Robust to UI changes that
56+
// move/hide individual controls — previously this probed `Iso: \d+` inside
57+
// the Surface section, which now hides in heatmap (default) mode.
58+
await page.waitForFunction(
59+
() => (window as unknown as { __elvisCameraReady?: boolean }).__elvisCameraReady === true,
60+
{ timeout: 10000 },
61+
)
5862
}
5963

6064
/** Enter slice mode and wait for the keymap to be active. */

pkgs/static/src/App.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1792,6 +1792,7 @@ export default function App() {
17921792
{primaryFile && (
17931793
<ErrorBoundary label="Controls" resetKey={`${materialId}:${effectiveIsoLevel}`}>
17941794
<Controls
1795+
isDiff={srcRole === 'diff'}
17951796
isoLevel={effectiveIsoLevel}
17961797
defaultIsoLevel={defaultIsoLevel}
17971798
maxDensity={maxDensity}

0 commit comments

Comments
 (0)