Fix viewer tooltip clipped at top of viewport (#282) - #283
Merged
Conversation
Add documentation for the `coz suggest-points` subcommand (LLM tool-use agent that proposes progress point placements), the macOS-specific architecture (`mac_interpose.cpp`, `macho_support.cpp`, `lief_loader.cpp`, DYLD interposition, dSYM lookup, wall-clock timer handling, nanosleep overshoot tracking), and the `path_filter.h` Rust stdlib filter. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Tooltips were placed above the hovered point ('n') by default, so points
near the top of the viewport had their tooltip cut off at the top edge.
Decide the tooltip direction from the circle's actual screen position in
the mouseover handler (where `this` is the hovered element) instead of the
static .direction() callback (where only the datum is available): flip to
'south' when the point is near the top, keep 'west' near the right edge,
otherwise 'north'. Offsets are adjusted per direction.
Recompiled viewer/js/profile.js from the TypeScript source.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Summary
Fixes #282 — tooltips in the
coz plotviewer were cut off at the top edge when hovering over data points high on the screen.Root cause
In
viewer/ts/profile.tsthe d3-tip tooltip direction was hardcoded to'n'(above the point) unlessspeedup > 0.8. For any point near the top of the viewport, placing the tooltip above it pushed it off-screen. The static.direction()callback could not fix this because inside itthisis the tip object (not the hovered circle), so it had no access to the point's screen position.Fix
Decide the tooltip direction inside the
mouseoverhandler, wherethisis the hovered<circle>, using its real screen position viagetBoundingClientRect():'s')speedup > 0.8) → place it left ('w', previous behavior)'n', as before)The offset is adjusted per direction so the gap/arrow stays correct.
Recompiled the committed
viewer/js/profile.jsfrom the TypeScript source (tsc -p tsconfig.json).Testing
Viewer-only, browser-side change. Verified
tscbuilds cleanly and the compiled JS contains the new logic. Confirm visually withcoz plotby hovering a point in a top-row plot — the tooltip now flips below the point instead of being clipped.🤖 Generated with Claude Code