From 644c1b70ca3d9e3695fa9a159e1a2882d80949b9 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 28 Feb 2022 18:15:39 +0700 Subject: Skip `Canvas::draw` if `bounds` have no logical pixels --- graphics/src/widget/canvas.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'graphics/src') diff --git a/graphics/src/widget/canvas.rs b/graphics/src/widget/canvas.rs index 157aa25c..65d7e37e 100644 --- a/graphics/src/widget/canvas.rs +++ b/graphics/src/widget/canvas.rs @@ -211,6 +211,11 @@ where use iced_native::Renderer as _; let bounds = layout.bounds(); + + if bounds.width < 1.0 || bounds.height < 1.0 { + return; + } + let translation = Vector::new(bounds.x, bounds.y); let cursor = Cursor::from_window_position(cursor_position); -- cgit