mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 20:56:43 +01:00
wip: reenable dynamic dispatch
This commit is contained in:
parent
600d0b3aca
commit
ac3827b8f3
11 changed files with 997 additions and 194 deletions
|
|
@ -25,7 +25,7 @@ impl<E: Engine, T: Content<E>> Content<E> for Align<T> {
|
|||
}
|
||||
fn layout (&self, on: E::Area) -> E::Area {
|
||||
use Alignment::*;
|
||||
let it = self.content().layout(on).xywh();
|
||||
let it = Render::layout(&self.content(), on).xywh();
|
||||
let centered = on.center_xy(it.wh());
|
||||
let far_x = (on.x() + on.w()).minus(it.w());
|
||||
let far_y = (on.y() + on.h()).minus(it.h());
|
||||
|
|
@ -47,6 +47,8 @@ impl<E: Engine, T: Content<E>> Content<E> for Align<T> {
|
|||
[x, y, centered.w(), centered.h()].into()
|
||||
}
|
||||
fn render (&self, render: &mut E::Output) {
|
||||
render.place(self.layout(render.area()), &self.content())
|
||||
let content = &self.content();
|
||||
let it = Render::layout(content, render.area()).xywh();
|
||||
render.place(it.into(), content)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue