diff options
author | 2022-02-28 18:15:39 +0700 | |
---|---|---|
committer | 2022-02-28 18:15:39 +0700 | |
commit | 644c1b70ca3d9e3695fa9a159e1a2882d80949b9 (patch) | |
tree | 67b576bfe324ac3f6bbc252a6f4a665348236243 /graphics/src/widget/canvas.rs | |
parent | af7cbf0003496d757696ea6e15ea32f0649cf8f9 (diff) | |
download | iced-644c1b70ca3d9e3695fa9a159e1a2882d80949b9.tar.gz iced-644c1b70ca3d9e3695fa9a159e1a2882d80949b9.tar.bz2 iced-644c1b70ca3d9e3695fa9a159e1a2882d80949b9.zip |
Skip `Canvas::draw` if `bounds` have no logical pixels
Diffstat (limited to 'graphics/src/widget/canvas.rs')
-rw-r--r-- | graphics/src/widget/canvas.rs | 5 |
1 files changed, 5 insertions, 0 deletions
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); |