fix Fixed

This commit is contained in:
🪞👃🪞 2025-01-01 19:08:57 +01:00
parent 01dacd407d
commit 8c28ef2bd7
4 changed files with 31 additions and 29 deletions

View file

@ -42,23 +42,25 @@ macro_rules! transform_xy_unit {
}
transform_xy_unit!(|self: Fixed, area|{
let area = self.content().layout(area);
let [x, y, 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, _) => [area.x(), area.y(), *fw, area.h()],
Self::Y(fh, _) => [area.x(), area.y(), area.w(), *fh],
Self::XY(fw, fh, _) => [area.x(), area.y(), *fw, *fh], // tagn
Self::X(fw, _) => [x, y, *fw, h],
Self::Y(fh, _) => [x, y, w, *fh],
Self::XY(fw, fh, _) => [x, y, *fw, *fh],
}
});
transform_xy_unit!(|self: Shrink, area|{
let area = self.content().layout(area);
[area.x(), area.y(), area.w().minus(self.dx()), area.h().minus(self.dy())]
});
transform_xy_unit!(|self: Shrink, area|self.content().layout([
area.x(), area.y(), area.w().minus(self.dx()), area.h().minus(self.dy())
].into()));
transform_xy_unit!(|self: Expand, area|{
let area = self.content().layout(area);
[area.x(), area.y(), area.w() + self.dx(), area.h() + self.dy()]
});
transform_xy_unit!(|self: Expand, area|self.content().layout([
area.x(), area.y(), area.w() + self.dx(), area.h() + self.dy()
].into()));
transform_xy_unit!(|self: Min, area|{
let area = self.content().layout(area);