Introduce viewport to Widget::draw
This should eventually allow us to only generate primitives that are visible.
This commit is contained in:
parent
8a3ce90959
commit
d328b07b39
31 changed files with 123 additions and 35 deletions
|
|
@ -12,7 +12,7 @@ mod circle {
|
|||
use iced_graphics::{Backend, Defaults, Primitive, Renderer};
|
||||
use iced_native::{
|
||||
layout, mouse, Background, Color, Element, Hasher, Layout, Length,
|
||||
Point, Size, Widget,
|
||||
Point, Rectangle, Size, Widget,
|
||||
};
|
||||
|
||||
pub struct Circle {
|
||||
|
|
@ -60,6 +60,7 @@ mod circle {
|
|||
_defaults: &Defaults,
|
||||
layout: Layout<'_>,
|
||||
_cursor_position: Point,
|
||||
_viewport: &Rectangle,
|
||||
) -> (Primitive, mouse::Interaction) {
|
||||
(
|
||||
Primitive::Quad {
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ mod rainbow {
|
|||
Backend, Defaults, Primitive, Renderer,
|
||||
};
|
||||
use iced_native::{
|
||||
layout, mouse, Element, Hasher, Layout, Length, Point, Size, Vector,
|
||||
Widget,
|
||||
layout, mouse, Element, Hasher, Layout, Length, Point, Rectangle, Size,
|
||||
Vector, Widget,
|
||||
};
|
||||
|
||||
pub struct Rainbow;
|
||||
|
|
@ -57,6 +57,7 @@ mod rainbow {
|
|||
_defaults: &Defaults,
|
||||
layout: Layout<'_>,
|
||||
cursor_position: Point,
|
||||
_viewport: &Rectangle,
|
||||
) -> (Primitive, mouse::Interaction) {
|
||||
let b = layout.bounds();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue