summaryrefslogtreecommitdiffstats
path: root/graphics/src/widget/row.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-08-18 03:37:32 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-10-28 06:21:07 +0100
commitd328b07b3937c968fc8139f0b5c61903ebb893e7 (patch)
tree940ae9e93006ad4fdae2d86a2f70833ee99e0b10 /graphics/src/widget/row.rs
parent8a3ce90959e281cd73a7486d800df8d65478a698 (diff)
downloadiced-d328b07b3937c968fc8139f0b5c61903ebb893e7.tar.gz
iced-d328b07b3937c968fc8139f0b5c61903ebb893e7.tar.bz2
iced-d328b07b3937c968fc8139f0b5c61903ebb893e7.zip
Introduce `viewport` to `Widget::draw`
This should eventually allow us to only generate primitives that are visible.
Diffstat (limited to '')
-rw-r--r--graphics/src/widget/row.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/graphics/src/widget/row.rs b/graphics/src/widget/row.rs
index 4c1dbadc..397d80bf 100644
--- a/graphics/src/widget/row.rs
+++ b/graphics/src/widget/row.rs
@@ -1,7 +1,7 @@
use crate::{Backend, Primitive, Renderer};
use iced_native::mouse;
use iced_native::row;
-use iced_native::{Element, Layout, Point};
+use iced_native::{Element, Layout, Point, Rectangle};
/// A container that distributes its contents horizontally.
pub type Row<'a, Message, Backend> =
@@ -17,6 +17,7 @@ where
content: &[Element<'_, Message, Self>],
layout: Layout<'_>,
cursor_position: Point,
+ viewport: &Rectangle,
) -> Self::Output {
let mut mouse_interaction = mouse::Interaction::default();
@@ -26,8 +27,13 @@ where
.iter()
.zip(layout.children())
.map(|(child, layout)| {
- let (primitive, new_mouse_interaction) =
- child.draw(self, defaults, layout, cursor_position);
+ let (primitive, new_mouse_interaction) = child.draw(
+ self,
+ defaults,
+ layout,
+ cursor_position,
+ viewport,
+ );
if new_mouse_interaction > mouse_interaction {
mouse_interaction = new_mouse_interaction;