fix and test alignments

This commit is contained in:
🪞👃🪞 2025-01-01 21:04:39 +01:00
parent 9125e04e07
commit 3c14456566
8 changed files with 135 additions and 100 deletions

View file

@ -42,16 +42,16 @@ macro_rules! transform_xy_unit {
}
transform_xy_unit!(|self: Fixed, area|{
let [x, y, w, h] = self.content().layout(area.center_xy(match self {
let [w, h] = self.content().layout(area.center_xy(match self {
Self::X(fw, _) => [*fw, area.h()],
Self::Y(fh, _) => [area.w(), *fh],
Self::XY(fw, fh, _) => [*fw, *fh],
}).into()).xywh();
match self {
Self::X(fw, _) => [x, y, *fw, h],
Self::Y(fh, _) => [x, y, w, *fh],
Self::XY(fw, fh, _) => [x, y, *fw, *fh],
}
}).into()).wh();
area.center_xy(match self {
Self::X(fw, _) => [*fw, h],
Self::Y(fh, _) => [w, *fh],
Self::XY(fw, fh, _) => [*fw, *fh],
})
});
transform_xy_unit!(|self: Shrink, area|self.content().layout([
@ -78,10 +78,9 @@ transform_xy_unit!(|self: Max, area|{
Self::XY(mw, mh, _) => [area.x(), area.y(), area.w().min(*mw), area.h().min(*mh)],
}});
transform_xy_unit!(|self: Push, area|{
let area = self.content().layout(area);
[area.x() + self.dx(), area.y() + self.dy(), area.w(), area.h()]
});
transform_xy_unit!(|self: Push, area|self.content().layout([
area.x() + self.dx(), area.y() + self.dy(), area.w(), area.h()
].into()));
transform_xy_unit!(|self: Pull, area|{
let area = self.content().layout(area);