diff options
author | 2021-10-14 16:07:22 +0700 | |
---|---|---|
committer | 2021-10-14 16:07:22 +0700 | |
commit | 03b34931383e701c39c653a7662a616fe21a0947 (patch) | |
tree | 8c0773d50b615dbc62210db8919ecb97ca912bd9 /graphics/src/widget/canvas.rs | |
parent | 3aae45c1913e6a6f60b009f19d00d10add7ad11e (diff) | |
download | iced-03b34931383e701c39c653a7662a616fe21a0947.tar.gz iced-03b34931383e701c39c653a7662a616fe21a0947.tar.bz2 iced-03b34931383e701c39c653a7662a616fe21a0947.zip |
Remove trait-specific draw logic in `iced_native`
Diffstat (limited to 'graphics/src/widget/canvas.rs')
-rw-r--r-- | graphics/src/widget/canvas.rs | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/graphics/src/widget/canvas.rs b/graphics/src/widget/canvas.rs index 7897c8ec..7bf00ca5 100644 --- a/graphics/src/widget/canvas.rs +++ b/graphics/src/widget/canvas.rs @@ -3,12 +3,10 @@ //! A [`Canvas`] widget can be used to draw different kinds of 2D shapes in a //! [`Frame`]. It can be used for animation, data visualization, game graphics, //! and more! -use crate::{Backend, Defaults, Primitive, Renderer}; +use crate::{Backend, Defaults, Renderer}; use iced_native::layout; -use iced_native::mouse; use iced_native::{ - Clipboard, Element, Hasher, Layout, Length, Point, Rectangle, Size, Vector, - Widget, + Clipboard, Element, Hasher, Layout, Length, Point, Rectangle, Size, Widget, }; use std::hash::Hash; use std::marker::PhantomData; @@ -190,28 +188,29 @@ where &self, _renderer: &mut Renderer<B>, _defaults: &Defaults, - layout: Layout<'_>, - cursor_position: Point, + _layout: Layout<'_>, + _cursor_position: Point, _viewport: &Rectangle, - ) -> (Primitive, mouse::Interaction) { - let bounds = layout.bounds(); - let translation = Vector::new(bounds.x, bounds.y); - let cursor = Cursor::from_window_position(cursor_position); - - ( - Primitive::Translate { - translation, - content: Box::new(Primitive::Group { - primitives: self - .program - .draw(bounds, cursor) - .into_iter() - .map(Geometry::into_primitive) - .collect(), - }), - }, - self.program.mouse_interaction(bounds, cursor), - ) + ) { + // let bounds = layout.bounds(); + // let translation = Vector::new(bounds.x, bounds.y); + // let cursor = Cursor::from_window_position(cursor_position); + + // ( + // Primitive::Translate { + // translation, + // content: Box::new(Primitive::Group { + // primitives: self + // .program + // .draw(bounds, cursor) + // .into_iter() + // .map(Geometry::into_primitive) + // .collect(), + // }), + // }, + // self.program.mouse_interaction(bounds, cursor), + // ) + // TODO } fn hash_layout(&self, state: &mut Hasher) { |