diff options
author | 2019-10-11 23:30:53 +0200 | |
---|---|---|
committer | 2019-10-11 23:30:53 +0200 | |
commit | a031a6f2130b3913a2419e4cea859c22aa388213 (patch) | |
tree | afa21d830b0c2eefc7f4e083c33d13c5b462c137 /wgpu/src/renderer/text.rs | |
parent | 8846a239cf14edd464b1d09f6d6d57ad9b5c9fc7 (diff) | |
download | iced-a031a6f2130b3913a2419e4cea859c22aa388213.tar.gz iced-a031a6f2130b3913a2419e4cea859c22aa388213.tar.bz2 iced-a031a6f2130b3913a2419e4cea859c22aa388213.zip |
Handle mouse cursor in `iced_wgpu`
Diffstat (limited to 'wgpu/src/renderer/text.rs')
-rw-r--r-- | wgpu/src/renderer/text.rs | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/wgpu/src/renderer/text.rs b/wgpu/src/renderer/text.rs index 61349533..8fbade4e 100644 --- a/wgpu/src/renderer/text.rs +++ b/wgpu/src/renderer/text.rs @@ -1,5 +1,5 @@ use crate::{Primitive, Renderer}; -use iced_native::{text, Color, Layout, Node, Style, Text}; +use iced_native::{text, Color, Layout, MouseCursor, Node, Style, Text}; use wgpu_glyph::{GlyphCruncher, Section}; @@ -68,13 +68,16 @@ impl text::Renderer for Renderer { } fn draw(&mut self, text: &Text, layout: Layout<'_>) -> Self::Output { - Primitive::Text { - content: text.content.clone(), - size: f32::from(text.size.unwrap_or(20)), - bounds: layout.bounds(), - color: text.color.unwrap_or(Color::BLACK), - horizontal_alignment: text.horizontal_alignment, - vertical_alignment: text.vertical_alignment, - } + ( + Primitive::Text { + content: text.content.clone(), + size: f32::from(text.size.unwrap_or(20)), + bounds: layout.bounds(), + color: text.color.unwrap_or(Color::BLACK), + horizontal_alignment: text.horizontal_alignment, + vertical_alignment: text.vertical_alignment, + }, + MouseCursor::OutOfBounds, + ) } } |