mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +01:00
fix and test alignments
This commit is contained in:
parent
9125e04e07
commit
3c14456566
8 changed files with 135 additions and 100 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue