From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id B7C171FF0B4 for ; Fri, 27 Nov 2026 17:13:36 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id EA94D21842; Fri, 27 Nov 2026 17:13:11 +0100 (CET) From: Dominik Csapak To: pdm-devel@lists.proxmox.com Subject: [PATCH yew-widget-toolkit 19/38] widget: charts: map: don't render if the pointer moves over the same point Date: Fri, 27 Nov 2026 17:12:16 +0100 Message-ID: <20261127161241.3713494-20-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261127161241.3713494-1-d.csapak@proxmox.com> References: <20261127161241.3713494-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.252 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: ISWLGNAL6TK5FDOGO4XJNGKCK4MCTWFT X-Message-ID-Hash: ISWLGNAL6TK5FDOGO4XJNGKCK4MCTWFT X-MailFrom: d.csapak@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The tooltip follows the pointer, so every pointer move over a point rendered the whole map again, just to place the tooltip. If the tooltip is still shown for the same point, only align it to the new position instead. Signed-off-by: Dominik Csapak --- src/widget/charts/map/mod.rs | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/src/widget/charts/map/mod.rs b/src/widget/charts/map/mod.rs index eb15fd8..d75ea73 100644 --- a/src/widget/charts/map/mod.rs +++ b/src/widget/charts/map/mod.rs @@ -215,6 +215,18 @@ impl MapComp { self.clusters = clusters; } + fn align_tooltip(&self) { + if let Some((_, x, y)) = self.tooltip + && let Some(el) = self.tooltip_ref.get() + { + let _ = align_to_xy( + el, + (x as f64 + 10.0, y as f64 + 10.0), + crate::dom::align::Point::TopStart, + ); + } + } + fn update_info_alignment(&self, ctx: &Context) { if let (Some(_), Some(anchor), Some(el)) = ( self.info_visible, @@ -399,11 +411,15 @@ impl yew::Component for MapComp { self.fit_scale = fit_scale; self.cluster_points(ctx); } - Msg::Tooltip(index) => { - if index.is_none() && self.tooltip.is_none() { + Msg::Tooltip(tooltip) => { + let target = |tooltip: Option<(usize, i32, i32)>| Some(tooltip?.0); + let same_target = target(self.tooltip) == target(tooltip); + self.tooltip = tooltip; + if same_target { + // only the pointer moved, which does not need a render + self.align_tooltip(); return false; } - self.tooltip = index; } Msg::ToggleInfo(index) => { if self.info_visible == Some(index) { @@ -655,15 +671,7 @@ impl yew::Component for MapComp { } fn rendered(&mut self, ctx: &Context, _first_render: bool) { - if let &Some((_, x, y)) = &self.tooltip - && let Some(el) = self.tooltip_ref.get() - { - let _ = align_to_xy( - el, - (x as f64 + 10.0, y as f64 + 10.0), - crate::dom::align::Point::TopStart, - ); - } + self.align_tooltip(); self.update_info_alignment(ctx); } } -- 2.47.3