Skip to content

Commit

Permalink
Remove AlignSingle
Browse files Browse the repository at this point in the history
  • Loading branch information
dhardy committed Jan 13, 2024
1 parent c792102 commit f40e17d
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions crates/kas-core/src/layout/visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl<'a> BoxVisitor<'a> {
widget: &'a mut dyn Layout,
hints: AlignHints,
) -> Visitor<impl Visitable + 'a> {
Visitor(AlignSingle { widget, hints })
Self::align(Self::single(widget), hints)
}

/// Construct a sub-layout with alignment hints
Expand Down Expand Up @@ -276,30 +276,6 @@ impl<'a> Visitable for Single<'a> {
}
}

struct AlignSingle<'a> {
widget: &'a mut dyn Layout,
hints: AlignHints,
}

impl<'a> Visitable for AlignSingle<'a> {
fn size_rules(&mut self, sizer: SizeCx, axis: AxisInfo) -> SizeRules {
self.widget
.size_rules(sizer, axis.with_align_hints(self.hints))
}

fn set_rect(&mut self, cx: &mut ConfigCx, rect: Rect) {
self.widget.set_rect(cx, rect);
}

fn find_id(&mut self, coord: Coord) -> Option<Id> {
self.widget.find_id(coord)
}

fn draw(&mut self, mut draw: DrawCx) {
draw.recurse(self.widget)
}
}

struct Align<C: Visitable> {
child: C,
hints: AlignHints,
Expand Down

0 comments on commit f40e17d

Please sign in to comment.