Tools: measure a tool card only for the button under the pointer

With Show Tool Cards on, every tool button built and translated its card's hint lines on every frame to estimate the card's height. A button the pointer is not over now returns before that work.
This commit is contained in:
dotCooCoo
2026-11-16 09:37:26 -08:00
parent d0f7721d1d
commit 10e1c7472f
+6
View File
@@ -72,6 +72,12 @@ pub(crate) fn hover(resp: Response, tool: &ToolInfo, side: Side, tip: Option<Str
let prefs = prefs(&ctx);
let allowed = side == Side::Row || !flyout_drawn(&ctx);
let description = if prefs.on && allowed { tool_description(tool.id) } else { None };
// A button the pointer is not over shows neither a card nor a tool tip: skip measuring its card,
// and let `quiet` drop the button's quiet mark.
if description.is_some() && !resp.hovered() {
quiet(&ctx, &resp);
return resp;
}
let place = description.and_then(|d| placement(&ctx, resp.rect, side, height(tool.id, prefs.animated_zoom)).map(|p| (d, p)));
let Some((description, (align, others, gap))) = place else {
return match tip {