mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
space: prevent crash in Shrink
This commit is contained in:
parent
9c948e580f
commit
e9e99932d1
1 changed files with 12 additions and 3 deletions
|
|
@ -440,9 +440,18 @@ impl<E: Engine, T: Widget<Engine = E>> Widget for Shrink<E::Unit, T> {
|
||||||
type Engine = E;
|
type Engine = E;
|
||||||
fn layout (&self, to: E::Size) -> Perhaps<E::Size> {
|
fn layout (&self, to: E::Size) -> Perhaps<E::Size> {
|
||||||
Ok(self.inner().layout(to)?.map(|to|match *self {
|
Ok(self.inner().layout(to)?.map(|to|match *self {
|
||||||
Self::X(w, _) => [to.w() - w, to.h()],
|
Self::X(w, _) => [
|
||||||
Self::Y(h, _) => [to.w(), to.h() - h],
|
if to.w() > w { to.w() - w } else { 0.into() },
|
||||||
Self::XY(w, h, _) => [to.w() - w, to.h() - h]
|
to.h()
|
||||||
|
],
|
||||||
|
Self::Y(h, _) => [
|
||||||
|
to.w(),
|
||||||
|
if to.h() > h { to.h() - h } else { 0.into() }
|
||||||
|
],
|
||||||
|
Self::XY(w, h, _) => [
|
||||||
|
if to.w() > w { to.w() - w } else { 0.into() },
|
||||||
|
if to.h() > h { to.h() - h } else { 0.into() }
|
||||||
|
]
|
||||||
}.into()))
|
}.into()))
|
||||||
}
|
}
|
||||||
fn render (&self, to: &mut E::Output) -> Usually<()> {
|
fn render (&self, to: &mut E::Output) -> Usually<()> {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue