Skip to content

Fix negative chunk counts for inactive projection views - #268

Merged
seankmartin merged 2 commits into
feature/edit-modefrom
fix/spatial-skeleton-overview-and-chunk-counts
Nov 5, 2026
Merged

seankmartin merged 2 commits into
feature/edit-modefrom
fix/spatial-skeleton-overview-and-chunk-counts

Conversation

@afonsobspinto

@afonsobspinto afonsobspinto commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Switching from a populated projection view to an XY-only layout could display a negative projection chunk total such as 0/-30. The inactive projection widget now displays 0/0 and preserves its shared histogram data for reactivation.

Reproduce

  1. Open the exact four-panel starting state. It pins layout = "4panel-alt", projectionScale = 32131.726289914157 and crossSectionScale = 106.66666666666667, with both spacing controls at 8 px.
  2. Wait for the projection widget to settle; in the verified Chrome run it showed 18/18 chunks (cross sections 14/14).
  3. In that same preview, click the small square maximize button at the upper-right of the top-left XY panel (tooltip: "Switch to xy layout."). This removes the projection view while retaining its populated histogram. Keep the page loaded between steps 2 and 3: the counter bug depends on this transition.
  4. Before this fix, the inactive projection widget displays 0/-30 (the verified XY widget showed 6/6). The value can persist while changing cross-section zoom. After the fix, the inactive projection counter displays 0/0.

Cause and fix

The widget zeroed the shared histogram bins when the view became inactive, but still subtracted the unchanged count of indicator-only bars. Three bars of ten entries yielded 0 - 30. Clearing those shared bins also discarded data needed when the view became active again.

Render inactive histograms as empty without modifying their shared data, and subtract the indicator count only when the histogram is visible. Reactivating the view can reuse the retained histogram until the renderer updates it.

Validation

  • Regression tests cover an inactive projection with indicator-only bars showing 0/0, and preservation of shared bins across hiding and reactivation.
  • All 41 focused spatial skeleton and render-scale widget tests pass.
  • TypeScript, ESLint for the changed files, and whitespace checks pass.

Use projected source coverage for the spacing node budget and render inactive
histograms without clearing shared bins or subtracting indicator-only counts.
Add regression coverage for overview selection and histogram visibility.
Keep the inactive histogram counter fix and its regression tests. Restore
skeleton density selection and tests to feature/edit-mode behavior.
@afonsobspinto afonsobspinto changed the title Fix spatial skeleton overview selection and inactive projection counts Fix negative chunk counts for inactive projection views Nov 5, 2026
@afonsobspinto
afonsobspinto marked this pull request as ready for review November 5, 2026 01:31
@seankmartin
seankmartin merged commit 7d09cda into feature/edit-mode Nov 5, 2026
1 check passed
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.

2 participants