mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-25 17:00:29 +00:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user