Handle mouse cursor in iced_wgpu
This commit is contained in:
parent
8846a239cf
commit
a031a6f213
10 changed files with 104 additions and 67 deletions
|
|
@ -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,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue