Skip to content

fix: unblock the underside, make the cross-section real and movable, replace the selection heart (#8) - #9

Open
PouyanJay wants to merge 3 commits into
thebuggeddev:mainfrom
PouyanJay:fix/issue-8-viewer-ux
Open

fix: unblock the underside, make the cross-section real and movable, replace the selection heart (#8)#9
PouyanJay wants to merge 3 commits into
thebuggeddev:mainfrom
PouyanJay:fix/issue-8-viewer-ux

Conversation

@PouyanJay

@PouyanJay PouyanJay commented Aug 6, 2026

Copy link
Copy Markdown

Fixes #8. Thanks @Phantom-VK — all three reports were valid, and two of them turned out to be covering deeper bugs.

1. The view-blocking platform

Removed. The opaque plinth walled off the bottom of every specimen, so a full 360° orbit was impossible.

Three things leaned on it, so this wasn't a one-line delete:

  • The contact shadow that grounded the organ stays, but is now anchored to each organ's own bounding box (organs are fitted by their longest axis, so a fixed height left flat organs' shadows adrift) and fades by camera elevation, reaching zero before the camera crosses its plane. It can never sit between you and the specimen.
  • HOME_CAMERA.y drops 1.05 → 0.3, since nothing needs to be seen at an angle any more.
  • Isolate was literally defined as "fade the plinth". It now dims the remaining staging — shadow, particles, accent glow.

2. "Layers" doesn't cut the object

Correct, and the tool that does cut — Cross-section — was broken in four ways that would have hidden it even if found:

  • the sweep started fully clipped, so the organ blinked out before wiping back in
  • turning it off dropped the clipping planes before the reverse tween, so it popped
  • side = FrontSide meant the cut read as a hole through to the background rather than exposing anything
  • the plane was fixed in world space, so from half of all orbit positions it removed the half you couldn't see — the tool looked like it had done nothing

All four fixed, and Layers is now Wireframe, so no button promises something it doesn't do. The layered metaphor moved onto the tool that actually opens the organ up.

The cut is also now movable, which it wasn't before at all:

  • Sagittal / coronal / axial presets, plus Free (squares up to the current view). The plane lives in the organ's own space and is carried to world space through the pivot each frame, which is what makes a named plane stay named while the specimen is turned.
  • A depth slider whose travel is measured against each organ's own box projected onto the plane normal — so the same position means "halfway through" for an eyeball and for a pair of lungs. This also fixes a case where a plane pinned to the origin removed an entire kidney instead of sectioning one.
  • Flip, so both faces are reachable without orbiting around.
  • The plane itself is drawn in the scene: a translucent, accent-tinted pane with an outlined rim, posed at the exact cut in the organ's own space — so its orientation and depth are readable at a glance, and it rides the specimen through orbit, axis changes, depth drags, flips and the open/close sweep. A Plane checkbox in the section controls hides it for a clean look at the cut face; Reset restores it.
  • Markers on the discarded half fade out with it instead of floating in the gap.

Known limit, stated plainly

The models are single closed surface shells with no interior geometry (meshCount: 1). So the cut reveals whatever a given model actually contains — which is genuinely good for skin, eye, lungs and heart, and empty for brain and kidneys. No rendering technique can section anatomy that isn't in the file.

I prototyped a stencil-buffer cap that fills the cut face, and removed it: with shell geometry the parity test reports "solid" across the whole silhouette, so it painted a heart as a solid block of myocardium and hid the real modelled atria underneath. For a teaching tool that's worse than an honest hollow. Proper interiors need segmented assets (per-structure closed meshes); that's tracked separately.

3. The heart icon

Replaced with a check mark. The heart read as "favourited", a meaning the Bookmark control in the panel heading already owns. The list also carries role="radiogroup" / aria-checked now — selection previously had no programmatic representation at all, only a CSS class.

Also fixed along the way

The toolbar tracked a single activeTool: string | null while Isolate, Cross-section and Wireframe are independent toggles — so two could be on with only one lit, and Reset cleared the highlight while leaving the cut applied in the viewer. Tool state is now a record, and reset() clears the viewer as well as the buttons.

Verification

Driven in a real browser with Playwright, not just typechecked:

  • full 360° orbit incl. directly underneath, all 9 organs
  • cut across all 9 organs × 4 plane orientations, full depth sweep on each
  • cut carried across organ switches, including 4 rapid switches mid-fade
  • Isolate + Wireframe simultaneously; Reset clears both
  • mobile (390×844) — panel clears the caption, auto-rotate pill and tool bar; slider and flip reachable
  • prefers-reduced-motion
  • tsc --noEmit and eslint app clean

Note: npm test is already failing on maintests/rendered-html.test.mjs still asserts the deleted starter skeleton (app/_sites-preview/, react-loading-skeleton, title: "Starter Project"). Pre-existing, untouched here.

…tion

Addresses the three reports in issue thebuggeddev#8.

1. The plinth walled off the bottom of every specimen, so a full 360°
   orbit was impossible. It is gone. The contact shadow that grounded
   the organ stays, but is now anchored to each organ's own footprint
   and fades out as the camera drops toward its plane, so it can never
   sit between the viewer and the specimen. Isolate used to be defined
   as "fade the plinth"; it now dims the remaining staging — shadow,
   particles, accent glow. Home framing drops to near eye level, since
   there is no longer a disc that needs to be seen at an angle.

2. "Layers" only toggled wireframe, and the tool that does cut — Cross-
   section — was broken in ways that hid it: the sweep started fully
   clipped so the organ blinked out, turning it off dropped the planes
   before the reverse tween, and front-face-only shells left the cut
   reading as a hole through to the background. The cut now wipes in
   from whole, wipes back out before releasing, renders both sides so
   the interior is actually exposed, aims itself away from the camera
   so it opens toward the viewer from any orbit, and holds auto-rotate
   while it is active. The wireframe tool keeps its behaviour under an
   honest label.

3. The selected organ was marked with a filled heart, which reads as
   "favourited" — a meaning the Bookmark control in the panel heading
   already owns. It is a check mark now, and the list carries radio
   semantics so selection is exposed to assistive tech rather than
   being colour and an icon alone.

Also makes the three viewer tools independent toggles instead of one
"active tool" that could only ever describe one of them, and has reset()
clear them in the viewer as well as in the toolbar.
The cut had no controls at all: one fixed plane, no way to change where it
sat or which way it faced. That also meant it could not be aimed at anything
in particular, and on a paired organ it removed a whole kidney rather than
sectioning one.

The plane now lives in the organ's own space and is carried out to world
space through the pivot each frame, because three.js only clips in world
space. That is what lets a plane be *named*: a sagittal cut stays sagittal
while the specimen is turned, so the presets mean what they say and the
viewer teaches the vocabulary rather than just making a cut.

On top of that:

- Sagittal, coronal and axial presets, plus Free, which squares the plane up
  to the current view and then leaves it there — the previous behaviour,
  kept as one option rather than the only one.
- A depth slider whose travel is measured against each organ's own bounding
  box projected onto the plane normal. The same slider position means
  "halfway through" for an eyeball and for a pair of lungs, and every
  position lands inside the specimen. This is what fixes the kidneys.
- Flip, so both faces are reachable without orbiting around.
- Markers on the discarded half fade out with it instead of floating in the
  gap, which was unnoticeable with a fixed plane and glaring once it sweeps.

Opening a cut now switches auto-rotate off through the normal control rather
than overriding it in applyAutoRotate. The old override left the toggle
claiming to be on while nothing moved, and locked out anyone who did want to
turn a sectioned specimen.
@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown

@PouyanJay is attempting to deploy a commit to the thebuggeddev-9222's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Phantom-VK

Phantom-VK commented Aug 7, 2026

Copy link
Copy Markdown

@PouyanJay thank you for picking up the issue, can you please add screenshots of how the UI/UX looking now, after the changes?

The cross-section now shows the plane doing the cutting: a translucent,
accent-tinted pane with an outlined rim, posed in organ space so it rides
the specimen through the intro, orbit, axis changes, depth drags, flips,
and the open/close sweep. A Plane checkbox in the section controls shows
or hides it; Reset restores it.
@PouyanJay

Copy link
Copy Markdown
Author
Screenshot 2026-08-07 at 12 42 15 AM @Phantom-VK

@PouyanJay
PouyanJay force-pushed the fix/issue-8-viewer-ux branch from 136467e to cf99e88 Compare August 7, 2026 07:46
@Phantom-VK

Copy link
Copy Markdown

Screenshot 2026-08-07 at 12 42 15 AM @Phantom-VK

Looking good!

@PouyanJay

Copy link
Copy Markdown
Author

@thebuggeddev just a reminder about this PR :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: Remove the view blocking platform, layer cutting functionality broken and replace heart icon with check icon

2 participants