Remove trait-specific draw logic in iced_native
This commit is contained in:
parent
3aae45c191
commit
03b3493138
71 changed files with 641 additions and 3126 deletions
|
|
@ -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);
|
||||
) {
|
||||
// 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),
|
||||
)
|
||||
// (
|
||||
// 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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue