Rerasterize SVGs when resized and refactor a bit
This commit is contained in:
parent
27717bc70c
commit
09707f29fc
8 changed files with 543 additions and 273 deletions
|
|
@ -6,5 +6,6 @@ mod radio;
|
|||
mod row;
|
||||
mod scrollable;
|
||||
mod slider;
|
||||
mod svg;
|
||||
mod text;
|
||||
mod text_input;
|
||||
|
|
|
|||
22
wgpu/src/renderer/widget/svg.rs
Normal file
22
wgpu/src/renderer/widget/svg.rs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
use crate::{Primitive, Renderer};
|
||||
use iced_native::{svg, Layout, MouseCursor};
|
||||
|
||||
impl svg::Renderer for Renderer {
|
||||
fn dimensions(&self, handle: &svg::Handle) -> (u32, u32) {
|
||||
self.image_pipeline.viewport_dimensions(handle)
|
||||
}
|
||||
|
||||
fn draw(
|
||||
&mut self,
|
||||
handle: svg::Handle,
|
||||
layout: Layout<'_>,
|
||||
) -> Self::Output {
|
||||
(
|
||||
Primitive::Svg {
|
||||
handle,
|
||||
bounds: layout.bounds(),
|
||||
},
|
||||
MouseCursor::OutOfBounds,
|
||||
)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue