Repository navigation
fix(timeline): keep ruler labels from running into each other - #68
Merged
Merged
Conversation
Major ticks were kept at least 70 px apart however long their labels were. Deep into a long capture the labels grow to many digits, such as 10.80115195 at 10 ns a division 10.8 s in, which is 69 px of text, so at some zoom levels neighbouring labels ran into one another. Which levels depends on the window width and display scaling, so it showed on some computers only. Measure the labels at both ends of the view in the ruler's font and take larger 1-2-5 steps until they keep 12 px apart. The overview strip shares the rule, and the time per division follows the step.
A major tick's label was left out near the ruler's left edge only when its tick was within 32 px of it, wherever its text began, so a long label such as 90.00000 covered the unit beside it. Leave out a label when its text would begin within 28 px of the edge, clear of the unit label 6 px in and at most 15 px wide; its mark stays.
DESIGN.md §6.1 now says that major ticks move further apart than 70 px when their labels need it, and that a label that would cover the unit is left out.
Merged
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.
Deep into a long capture the ruler's labels ran into one another, and the first one covered the unit. Major ticks were kept at least 70 px apart whatever their labels said, but the labels grow with the time and with the decimals a fine step needs: 10.8 s into a capture at 10 ns a division they read like 10.80115195, which is 69 px of text in the bundled 11 px IBM Plex Sans (figures 6.6 px, the point 3 px, measured in Chrome), 75 px with its padding. Whether a given zoom level lands in that range depends on the window width and display scaling, so it showed on some computers only.
rulerTicksestimates the labels at both ends of the view and takes larger 1-2-5 steps until neighbouring labels keep 12 px of room. The overview strip shares the rule, and the time per division in the status bar follows the step (10 ns/div becomes 20 ns/div in the case above).Label widths are estimated from the bundled font's metrics (
labelWidthinsrc/timeline/ticks.ts) rather than measured at run time; a change of the tick label font or size has to update them.Validation:
pnpm exec eslint srcpnpm typecheckpnpm test: 86 files, 609 tests passed, including new cases inticks.test.ts(the reported state: 10.8 s at 100 MHz, 71 px for 10 ns) andTimelineRuler.test.ts(a label at 40 px that would cover the unit), which fail on the previous code