mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2026-01-31 19:06:41 +01:00
output: refactor Content and Render traits
This commit is contained in:
parent
74b3af2212
commit
1c21a85f27
24 changed files with 346 additions and 613 deletions
|
|
@ -66,7 +66,7 @@ impl_map_direction!(south, y, n);
|
|||
impl_map_direction!(west, x, e);
|
||||
impl_map_direction!(north, y, s);
|
||||
|
||||
impl<'a, E, A, B, I, F, G> Content<E> for Map<E, A, B, I, F, G> where
|
||||
impl<'a, E, A, B, I, F, G> Render<E> for Map<E, A, B, I, F, G> where
|
||||
E: Output,
|
||||
B: Render<E>,
|
||||
I: Iterator<Item = A> + Send + Sync + 'a,
|
||||
|
|
@ -94,7 +94,7 @@ impl<'a, E, A, B, I, F, G> Content<E> for Map<E, A, B, I, F, G> where
|
|||
fn render (&self, to: &mut E) {
|
||||
let Self { get_iter, get_item, .. } = self;
|
||||
let mut index = 0;
|
||||
let area = Content::layout(self, to.area());
|
||||
let area = Render::layout(self, to.area());
|
||||
for item in get_iter() {
|
||||
let item = get_item(item, index);
|
||||
//to.place(area.into(), &item);
|
||||
|
|
@ -107,24 +107,24 @@ impl<'a, E, A, B, I, F, G> Content<E> for Map<E, A, B, I, F, G> where
|
|||
#[inline] pub fn map_south<O: Output>(
|
||||
item_offset: O::Unit,
|
||||
item_height: O::Unit,
|
||||
item: impl Content<O>
|
||||
) -> impl Content<O> {
|
||||
item: impl Render<O>
|
||||
) -> impl Render<O> {
|
||||
Push::y(item_offset, Fixed::y(item_height, Fill::x(item)))
|
||||
}
|
||||
|
||||
#[inline] pub fn map_south_west<O: Output>(
|
||||
item_offset: O::Unit,
|
||||
item_height: O::Unit,
|
||||
item: impl Content<O>
|
||||
) -> impl Content<O> {
|
||||
item: impl Render<O>
|
||||
) -> impl Render<O> {
|
||||
Push::y(item_offset, Align::nw(Fixed::y(item_height, Fill::x(item))))
|
||||
}
|
||||
|
||||
#[inline] pub fn map_east<O: Output>(
|
||||
item_offset: O::Unit,
|
||||
item_width: O::Unit,
|
||||
item: impl Content<O>
|
||||
) -> impl Content<O> {
|
||||
item: impl Render<O>
|
||||
) -> impl Render<O> {
|
||||
Push::x(item_offset, Align::w(Fixed::x(item_width, Fill::y(item))))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue