From 03b34931383e701c39c653a7662a616fe21a0947 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 14 Oct 2021 16:07:22 +0700 Subject: Remove trait-specific draw logic in `iced_native` --- graphics/src/widget/svg.rs | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'graphics/src/widget/svg.rs') diff --git a/graphics/src/widget/svg.rs b/graphics/src/widget/svg.rs index 8b5ed66a..b74a0abb 100644 --- a/graphics/src/widget/svg.rs +++ b/graphics/src/widget/svg.rs @@ -1,7 +1,7 @@ //! Display vector graphics in your application. use crate::backend::{self, Backend}; -use crate::{Primitive, Renderer}; -use iced_native::{mouse, svg, Layout}; +use crate::Renderer; +use iced_native::svg; pub use iced_native::svg::{Handle, Svg}; @@ -12,18 +12,4 @@ where fn dimensions(&self, handle: &svg::Handle) -> (u32, u32) { self.backend().viewport_dimensions(handle) } - - fn draw( - &mut self, - handle: svg::Handle, - layout: Layout<'_>, - ) -> Self::Output { - ( - Primitive::Svg { - handle, - bounds: layout.bounds(), - }, - mouse::Interaction::default(), - ) - } } -- cgit From e6156fb0c53d78ae75a1d85d4bfd81f6b7e8817e Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 28 Oct 2021 22:13:26 +0700 Subject: Implement `Widget::draw` for `Svg` --- graphics/src/widget/svg.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'graphics/src/widget/svg.rs') diff --git a/graphics/src/widget/svg.rs b/graphics/src/widget/svg.rs index b74a0abb..621f1a85 100644 --- a/graphics/src/widget/svg.rs +++ b/graphics/src/widget/svg.rs @@ -1,6 +1,6 @@ //! Display vector graphics in your application. use crate::backend::{self, Backend}; -use crate::Renderer; +use crate::{Primitive, Rectangle, Renderer}; use iced_native::svg; pub use iced_native::svg::{Handle, Svg}; @@ -12,4 +12,8 @@ where fn dimensions(&self, handle: &svg::Handle) -> (u32, u32) { self.backend().viewport_dimensions(handle) } + + fn draw(&mut self, handle: svg::Handle, bounds: Rectangle) { + self.draw_primitive(Primitive::Svg { handle, bounds }) + } } -- cgit From 0aafcde0ef1533c9eeba0379de8c0082e30c7504 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sun, 31 Oct 2021 15:35:12 +0700 Subject: Remove `widget` module re-exports in `iced_native` --- graphics/src/widget/svg.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'graphics/src/widget/svg.rs') diff --git a/graphics/src/widget/svg.rs b/graphics/src/widget/svg.rs index 621f1a85..64a2b461 100644 --- a/graphics/src/widget/svg.rs +++ b/graphics/src/widget/svg.rs @@ -1,9 +1,9 @@ //! Display vector graphics in your application. use crate::backend::{self, Backend}; use crate::{Primitive, Rectangle, Renderer}; -use iced_native::svg; +use iced_native::widget::svg; -pub use iced_native::svg::{Handle, Svg}; +pub use iced_native::widget::svg::{Handle, Svg}; impl svg::Renderer for Renderer where -- cgit From 9a3c81f336b8e29c64471026860f3c9d8b56348c Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sun, 31 Oct 2021 16:24:31 +0700 Subject: Introduce first-class `svg` module in `iced_native` --- graphics/src/widget/svg.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'graphics/src/widget/svg.rs') diff --git a/graphics/src/widget/svg.rs b/graphics/src/widget/svg.rs index 64a2b461..5817a552 100644 --- a/graphics/src/widget/svg.rs +++ b/graphics/src/widget/svg.rs @@ -1,9 +1,10 @@ //! Display vector graphics in your application. use crate::backend::{self, Backend}; use crate::{Primitive, Rectangle, Renderer}; -use iced_native::widget::svg; +use iced_native::svg; -pub use iced_native::widget::svg::{Handle, Svg}; +pub use iced_native::widget::svg::Svg; +pub use svg::Handle; impl svg::Renderer for Renderer where -- cgit