mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
wip: reenable dynamic dispatch
This commit is contained in:
parent
600d0b3aca
commit
ac3827b8f3
11 changed files with 997 additions and 194 deletions
|
|
@ -42,7 +42,7 @@ macro_rules! transform_xy_unit {
|
|||
}
|
||||
|
||||
transform_xy_unit!(|self: Fixed, area|{
|
||||
let [w, h] = self.content().layout(area.center_xy(match self {
|
||||
let [w, h] = Render::layout(&self.content(), area.center_xy(match self {
|
||||
Self::X(fw, _) => [*fw, area.h()],
|
||||
Self::Y(fh, _) => [area.w(), *fh],
|
||||
Self::XY(fw, fh, _) => [*fw, *fh],
|
||||
|
|
@ -54,16 +54,16 @@ transform_xy_unit!(|self: Fixed, area|{
|
|||
})
|
||||
});
|
||||
|
||||
transform_xy_unit!(|self: Shrink, area|self.content().layout([
|
||||
transform_xy_unit!(|self: Shrink, area|Render::layout(&self.content(), [
|
||||
area.x(), area.y(), area.w().minus(self.dx()), area.h().minus(self.dy())
|
||||
].into()));
|
||||
|
||||
transform_xy_unit!(|self: Expand, area|self.content().layout([
|
||||
transform_xy_unit!(|self: Expand, area|Render::layout(&self.content(), [
|
||||
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);
|
||||
let area = Render::layout(&self.content(), area);
|
||||
match self {
|
||||
Self::X(mw, _) => [area.x(), area.y(), area.w().max(*mw), area.h()],
|
||||
Self::Y(mh, _) => [area.x(), area.y(), area.w(), area.h().max(*mh)],
|
||||
|
|
@ -71,31 +71,31 @@ transform_xy_unit!(|self: Min, area|{
|
|||
}});
|
||||
|
||||
transform_xy_unit!(|self: Max, area|{
|
||||
let area = self.content().layout(area);
|
||||
let area = Render::layout(&self.content(), area);
|
||||
match self {
|
||||
Self::X(mw, _) => [area.x(), area.y(), area.w().min(*mw), area.h()],
|
||||
Self::Y(mh, _) => [area.x(), area.y(), area.w(), area.h().min(*mh)],
|
||||
Self::XY(mw, mh, _) => [area.x(), area.y(), area.w().min(*mw), area.h().min(*mh)],
|
||||
}});
|
||||
|
||||
transform_xy_unit!(|self: Push, area|self.content().layout([
|
||||
transform_xy_unit!(|self: Push, area|Render::layout(&self.content(), [
|
||||
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);
|
||||
let area = Render::layout(&self.content(), area);
|
||||
[area.x().minus(self.dx()), area.y().minus(self.dy()), area.w(), area.h()]
|
||||
});
|
||||
|
||||
transform_xy_unit!(|self: Margin, area|{
|
||||
let area = self.content().layout(area);
|
||||
let area = Render::layout(&self.content(), area);
|
||||
let dx = self.dx();
|
||||
let dy = self.dy();
|
||||
[area.x().minus(dx), area.y().minus(dy), area.w() + dy + dy, area.h() + dy + dy]
|
||||
});
|
||||
|
||||
transform_xy_unit!(|self: Padding, area|{
|
||||
let area = self.content().layout(area);
|
||||
let area = Render::layout(&self.content(), area);
|
||||
let dx = self.dx();
|
||||
let dy = self.dy();
|
||||
[area.x() + dx, area.y() + dy, area.w().minus(dy + dy), area.h().minus(dy + dy), ]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue