plot: Fix and polish chart hover tooltips#2507
Merged
Merged
Conversation
The `IntoPlot` derive painted the tooltip overlay inline during the plot's own `paint`, so any sibling drawn after the plot (e.g. a chart card's footer text) covered the part of the tooltip box that overflows the plot bounds. Wrap the overlay in `gpui::deferred(...)` before `prepaint_as_root` so it paints in the deferred pass, on top of the rest of the tree. `prepaint_as_root` keeps the plot-origin offset, so positioning is unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The derive generated `let Some(_) = ... else { return None }`, which trips
`clippy::question_mark` in downstream crates that derive `IntoPlot` (the
generated code is attributed to the call site via `quote!`). Emit `?` instead
so the generated code is lint-clean regardless of clippy version.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
`CrossLine` shared a single `start`/`length` across both axes, so a `both()` crosshair confined with `height()`/`span()` wrongly clipped the horizontal line to the vertical extent. Give each axis its own span and add `width()`/`h_span()` so the vertical and horizontal lines confine independently. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
de2fb5c to
2147d5d
Compare
top_0() on base
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.
Description
Follow-up fixes and polish for the interactive chart hover tooltips added in #2500.
top_0()on the tooltipbasestretched the box vertically; removed it.paint, so siblings drawn afterwards (e.g. a chart card footer) covered the part of the box overflowing the plot bounds. It's now wrapped ingpui::deferred(...)so it paints on top;prepaint_as_rootkeeps the plot-origin offset, so positioning is unchanged.IntoPlotderive emittedlet...else, which trippedclippy::question_markin crates that derive it. It now emits?so generated code is lint-clean.CrossLine::both()crosshair — both axes shared a single span, so confining the crosshair withheight()/span()clipped the horizontal line to the vertical extent. Each axis now confines independently.Breaking Changes
CrossLine::height()/span()now confine only the vertical line. Use the newwidth()/h_span()to confine the horizontal line.