Skip to content

fix: clamp vertical marker stacks at the canvas edge - #262

Merged
brandtnewlabs merged 2 commits into
brandtnewlabs:mainfrom
ianlapham:marker-edge-clamp
Aug 11, 2026
Merged

fix: clamp vertical marker stacks at the canvas edge#262
brandtnewlabs merged 2 commits into
brandtnewlabs:mainfrom
ianlapham:marker-edge-clamp

Conversation

@ianlapham

Copy link
Copy Markdown
Contributor

What

  • A "vertical" marker column is now also capped where the next glyph would cross the canvas edge, not just at maxVisible.
  • Stacks anchored near the top or bottom of the plot hide their off-canvas overflow (same hidden treatment as maxVisible); the base glyph always draws.

Bugs fixed

  • Vertical stacks climbed off the plot when their anchor sat near the canvas edge — maxVisible caps the glyph count but not the geometry, so a short cap on a tall chart still let edge-anchored columns escape.

Why bounds live on ClusterMarkersOpts, not MarkerClusterConfig

  • The canvas edge is call-site geometry, not user preference: the three internal callers pass 0 / canvasHeight, the clamp is always-on, and ClusterMarkersOpts stays unexported — no public API change.

Why canvas bounds, not plot-area bounds

  • Bounds are [0, canvasHeight], so a stack may still enter the axis gutters — glyphs stay fully visible, which is the bug being fixed; clamping to the padded plot rect would hide more than necessary.

Why the base slot always draws (cap floor of 1)

  • When the anchor itself sits at or past a bound the fit math goes negative; flooring at 1 keeps the marker visible at its anchor instead of vanishing the whole bucket.

Test plan

  • npm run verify green (typecheck, lint, 99 suites / 1502 tests); the pre-commit hook re-ran the tests on commit.
  • New markerCluster tests: fit math for above and below columns, cap floor of 1 with negative room, min(maxVisible, bounds cap) in both directions, pass-through when a bound is missing, and the step-0 (overlap: 1) guard. Existing tests pass unmodified (bounds omitted = behavior-identical).
  • Not re-verified visually in the example app here; this exact behavior has been running in production at FOMO as a carried patch.

🤖 Generated with Claude Code

ianlapham and others added 2 commits August 11, 2026 13:44

Copy link
Copy Markdown
Owner

Blocker resolved

Merged current main into this branch in 4e6f09d and resolved the only conflict in CHANGELOG.md by retaining both the vertical-marker-stack fix and the already-merged tail-less-badge fix.

The integrated tree was revalidated before pushing:

  • focused marker math/overlay/hit-test suites: 44 tests passed
  • npm run verify: passed against current main
  • React Doctor: 96/100; only the pre-existing large-component warning
  • agent-device QA on iPhone 17 Pro:
    • built-in and custom vertical stacks stop at both canvas edges
    • hidden overflow remains hidden
    • maxVisible: 4 remains the tighter cap
    • clean runtime logs after a full reload

No functional review findings remain.

@brandtnewlabs
brandtnewlabs merged commit 9580429 into brandtnewlabs:main Aug 11, 2026
3 checks 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