mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 09:42:21 +00:00
fix(overlays): keep painted hit rectangles until the next paint
Every overlay change cleared the world overlay's hit rectangles at once, and only the next paint rebuilt them. When one click subscriber published its selection card, every later subscriber in the same click saw no overlay at all, so the outcome of a click depended on listener order: a card or label painted over another layer's item could lose to that item, or both acted. Hit rectangles now stay what is painted on screen until the next paint rebuilds them, so every subscriber reads the overlay the user clicked, and a paint that draws nothing clears them.
This commit is contained in:
1 parent
b2bc15e763
commit
f6314884f7
2 files changed
+25
-5
No files matched your search
@@ -884,7 +884,9 @@ function invalidateHost({ solve = true, layout = false } = {}) {
|
||||
if (layout) _occludersDirty = true;
|
||||
_canvasNeedsClear = true;
|
||||
_paintRectCount = 0;
|
||||
_hitRectCount = 0;
|
||||
// Hit rectangles stay what is painted on screen until the next paint
|
||||
// rebuilds them: every click subscriber reads the same overlay, even after
|
||||
// an earlier one republishes entries in that click (a selection card).
|
||||
_paintRectByKey.clear();
|
||||
requestOverlayRender();
|
||||
}
|
||||
@@ -2783,10 +2785,9 @@ function drawWorldOverlay() {
|
||||
resetFrameDiagnostics();
|
||||
_solveDirty = false;
|
||||
if (_canvasNeedsClear || _detectionSurfaceNeedsClear) clearCanvas();
|
||||
if (_accessibilitySignature) {
|
||||
_hitRectCount = 0;
|
||||
syncAccessibleActions();
|
||||
}
|
||||
// Nothing is painted now, so nothing can be hit.
|
||||
_hitRectCount = 0;
|
||||
if (_accessibilitySignature) syncAccessibleActions();
|
||||
syncPaintVisibility(false);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user