From d8729ffd34a6cd8db7fd0af56186b642d2e67165 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sat, 12 Nov 2022 01:45:26 +0100 Subject: [PATCH] Add a minimum width to tooltip width comparison To make it flicker around less at the right edge of the X-Y pad. --- plugins/diopser/src/editor/xy_pad.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/diopser/src/editor/xy_pad.rs b/plugins/diopser/src/editor/xy_pad.rs index d40513d3..41c886f3 100644 --- a/plugins/diopser/src/editor/xy_pad.rs +++ b/plugins/diopser/src/editor/xy_pad.rs @@ -302,7 +302,12 @@ impl View for XyPad { .get_last_child(cx.current()) .expect("Missing child view in X-Y pad"); let tooltip_bounds = cx.cache.get_bounds(tooltip_entity); - self.tooltip_pos_x = if (relative_x + tooltip_bounds.w + 4.0) >= bounds.w { + // NOTE: The width can vary drastically depending on the frequency value, so we'll + // hardcode a minimum width in this comparison to avoid this from jumping + // around. The parameter value updates are a bit delayed when dragging the + // parameter, so we may be using an old width here. + self.tooltip_pos_x = if (relative_x + tooltip_bounds.w.max(150.0) + 4.0) >= bounds.w + { Pixels(relative_x - 2.0 - tooltip_bounds.w) } else { Pixels(relative_x + 2.0)