diff options
author | 2022-03-01 14:03:56 +0700 | |
---|---|---|
committer | 2022-03-01 14:03:56 +0700 | |
commit | ee6f4cb2ac7f322ef708fe0655835638bac841ea (patch) | |
tree | 358e18b1409374b54dfa4ad85a3ee23cdd554d82 | |
parent | f85b421ae7a029ea34c91be90da1a20505d6cd4b (diff) | |
parent | 644c1b70ca3d9e3695fa9a159e1a2882d80949b9 (diff) | |
download | iced-ee6f4cb2ac7f322ef708fe0655835638bac841ea.tar.gz iced-ee6f4cb2ac7f322ef708fe0655835638bac841ea.tar.bz2 iced-ee6f4cb2ac7f322ef708fe0655835638bac841ea.zip |
Merge pull request #1270 from iced-rs/skip-canvas-draw
Skip `Canvas::draw` if `bounds` have no logical pixels
-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); |