Record which widget is drawing a subtree that changed hands
A subtree can be reused whole under a different parent -- same box, same layer, same region node, clean -- and nothing in the drawing says it moved. Two things read who its parent is, and both were wrong after one of these. The old parent still listed it as a child, and a parent's next draw undraws whatever is missing from that list: two spans under one root, with the root swapping which of them it holds, drew the subtree under the new span and then erased it when the old one drew. The move is recorded on both sides where `draw_inner` already writes what the ask decided, rather than guarded at each reader. Its depth was also the one it had under the old parent, which is what the settling walk orders by, so a change made under it afterwards settled at the wrong point in the frame. `try_reuse` re-walks the subtree's depths, and only where the top of it moved, which is what makes that free in the ordinary case. Two tests: one shape where the subtree's box does not move and the span it left erases it, one where it changes depth and the change made under it has to reach the span it moved to. Each fails without one half.
This commit is contained in:
1 parent
a0693acc56
commit
e44dea34b4
3 files changed
+161
-19
No files matched your search
@@ -74,4 +74,12 @@ impl ActiveData {
|
||||
pub fn holds_at(&self, px: crate::PxVec2) -> bool {
|
||||
self.holds[0].contains(px.x) && self.holds[1].contains(px.y)
|
||||
}
|
||||
|
||||
/// Whether what it answered still stands for a box of these pixel
|
||||
/// lengths -- the box it was asked in, where `holds` is about the box its
|
||||
/// answer then chose.
|
||||
pub fn answers_at(&self, px: crate::PxVec2) -> bool {
|
||||
let (_, holds) = self.answer;
|
||||
holds[0].contains(px.x) && holds[1].contains(px.y)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user