Keep valid layout guarantees when a redraw widens their range
This commit is contained in:
1 parent
f860f716e6
commit
0e107f0e89
3 files changed
+46
-1
No files matched your search
@@ -1163,7 +1163,19 @@ impl UiRenderState {
|
||||
if info.placement != offered.placement {
|
||||
self.draw_inner(id, given, info, None, false, rsc);
|
||||
}
|
||||
if Some((answer.0, answer.1)) != was_answer || self.active[&id].holds != was_holds {
|
||||
let active = self.active.get_mut(&id).unwrap();
|
||||
// A wider contract does not invalidate the guarantee the parent kept.
|
||||
// Retain that guarantee so widening and narrowing back do not churn it.
|
||||
if let Some((size, holds)) = was_answer
|
||||
&& answer.0 == size
|
||||
&& answer.1.covers(holds)
|
||||
{
|
||||
active.answer = was_answer;
|
||||
}
|
||||
if active.holds.covers(was_holds) && was_holds.contains(given_px, active.placement) {
|
||||
active.holds = was_holds;
|
||||
}
|
||||
if active.answer != was_answer || active.holds != was_holds {
|
||||
// The parent retains both the answer and the drawing's validity;
|
||||
// even an unchanged size can narrow the range safe for a resize.
|
||||
#[cfg(feature = "layout-diagnostics")]
|
||||
|
||||
Reference in new issue
Block a user