Fix contact-id labels clustering on double-sided probes#71
Merged
alejoe91 merged 2 commits intoJul 15, 2026
Conversation
…vases Move the fit-to-contact contact-id sizing (computeIdLabelInfo + drawContactIds) and the contact-shape corner rounding into geometry/draw.ts, and thread the per-probe zoom cap through useProbeViewport. ProbeCanvas now sits on top of the shared hook and drawing layer instead of reimplementing them, and DoubleSidedProbeCanvas calls the same drawContactIds (restricted to the visible face) so double-sided probes get the same label sizing as single-sided ones. Drops ProbeCanvas's dead forwardRef; net ~290 fewer lines.
Extract computeGeometry/computeScale/computeProjection into geometry/viewport.ts and use it from useProbeViewport, both canvases, and exportUtils, removing the duplicate copies. The PNG export now draws contacts and the scale bar through geometry/draw.ts (keeping its export-only white background, drop-shadow, and opaque contour); the SVG export shares geometry/projection but keeps its own markup. PNG-exported contacts gain the rounded corners the screen and SVG already used.
alejoe91
approved these changes
Jul 15, 2026
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.
On double-sided probes (Cambridge NeuroTech
ASSY-325D-*), turning on contact ids makes the numbers collapse into an unreadable clump along each shank. You can see it on the current site: https://spikeinterface.github.io/probeinterface_library/#/probes/cambridgeneurotech/ASSY-325D-E-1?zoom=12&cx=0&cy=150&ids=1 . The same view of a single-sided probe stays clean, because #64 already sized labels to fit each contact there: https://spikeinterface.github.io/probeinterface_library/#/probes/cambridgeneurotech/ASSY-1-E-1?zoom=12&cx=0&cy=150&ids=1 . The double-sided viewer simply never got that fix, so its labels used a fixed screen-size font that ignores how big the contact actually is.This extends the fit-to-contact sizing from #64 to the double-sided viewer, so labels shrink and grow with their pads and stay legible at any zoom. The reason the fix went missing is that the two viewers (and the image export) each carried their own copy of the drawing code, so this also moves that shared code into one place so the same bug cannot reappear in only one of them. Preview on this branch: https://h-mayorquin.github.io/probeinterface_library/#/probes/cambridgeneurotech/ASSY-325D-E-1?zoom=55&cx=0&cy=150&ids=1