fix: even out the pen/highlighter middle size dot - #562
Merged
vibhavkatre merged 1 commit intoAug 27, 2026
Conversation
dotStyle scaled a size's preview dot by its VALUE's position in the row's range. The pen row's widths (2, 4, 8) aren't evenly spaced, so the middle option landed only a third of the way up — a dot barely bigger than small, then a big jump to large. The three options read as two: small and medium looked the same size. Scale by INDEX instead: every row has exactly three options, so three evenly-stepped diameters read as small/medium/large regardless of how far apart the underlying widths happen to be. Extracted dotStyle out of WhiteboardTools.vue into diagram/sizeDot.js so it has a real test covering the exact case that broke, instead of the restated copy sizeDots.test.js used to carry because the .vue file wasn't importable.
vibhavkatre
approved these changes
Aug 27, 2026
vibhavkatre
left a comment
Collaborator
There was a problem hiding this comment.
Verified against the source. Merging.
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.
Problem
The pen and highlighter size pickers show three preview dots (small/medium/large) meant to be visibly, proportionally distinct. In practice, the middle dot barely differed from the small one — small and medium read as the same size, with the only real jump landing between medium and large.
Root cause
dotStylescaled a size's preview dot by that size's value position within the row's own range:(size - smallest) / (largest - smallest).The pen row's widths are
[2, 4, 8]— not evenly spaced (gaps of 2 and 4). The middle value (4) sits only a third of the way between 2 and 8, so its dot landed close to the small dot's diameter, with the real jump saved for the small→large or medium→large step. The highlighter row ([10, 18, 26]) happens to be evenly spaced, so it didn't show the same defect as visibly — which is part of why this survived a first pass at #498.Fix
Scale by index in the row instead of by value. Every row always has exactly three options, so three evenly-stepped diameters (min, midpoint, max) read as small/medium/large regardless of how far apart the underlying widths happen to be — order is preserved (the arrays are already ascending), just the step size is now even.
Extracted
dotStyleout ofWhiteboardTools.vueintofrontend/src/diagram/sizeDot.jsso it has a real, importable unit test covering the exact case that broke —sizeDots.test.jsused to carry a hand-restated copy of the scaling logic because the.vuefile wasn't importable from the browser-free test env; it now imports the real function instead of maintaining a parallel copy that could drift.Testing
yarn vitest run— 150 files / 1735 tests pass.sizeDot.test.js: asserts the middle option is evenly between min/max regardless of value spacing, and pins the exact pen-vs-highlighter case that motivated the fix.sizeDots.test.jsupdated to import the realdotDiameterrather than restate it.🤖 Generated with Claude Code