Give widget access to taffy layout

This commit is contained in:
Joscha 2024-03-09 00:07:59 +01:00
parent f4a6435e6f
commit 4f14d70152
3 changed files with 26 additions and 8 deletions

View file

@ -1,4 +1,4 @@
use taffy::{AvailableSpace, Size};
use taffy::{AvailableSpace, Layout, Size};
use crate::{Node, View};
@ -19,13 +19,23 @@ pub trait Widget<C> {
///
/// Prefer this over [`Self::draw_above`] when implementing a leaf widget.
#[allow(unused_variables)]
fn draw_below(&mut self, ctx: &mut C, view: &mut View<'_>) -> anyhow::Result<()> {
fn draw_below(
&mut self,
ctx: &mut C,
view: &mut View<'_>,
layout: &Layout,
) -> anyhow::Result<()> {
Ok(())
}
/// Called after all children are drawn.
#[allow(unused_variables)]
fn draw_above(&mut self, ctx: &mut C, view: &mut View<'_>) -> anyhow::Result<()> {
fn draw_above(
&mut self,
ctx: &mut C,
view: &mut View<'_>,
layout: &Layout,
) -> anyhow::Result<()> {
Ok(())
}
}