mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-21 10:42:22 +00:00
Merge remote-tracking branch 'origin/main' into german/cctv-camera-counts
# Conflicts: # src/layers/cctv/lifecycle.test.mjs
This commit is contained in:
commit
2b7a6b0c63
1463 files changed
+48705
-10313
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { WORLD_OVERLAY_OCCLUDER_SELECTORS } from './worldOverlayChrome.js';
|
||||
import { setClickCardHitTest } from '../data/pickRegistry.js';
|
||||
export { WORLD_OVERLAY_OCCLUDER_SELECTORS } from './worldOverlayChrome.js';
|
||||
import {
|
||||
createCyberSonarSampler,
|
||||
@@ -887,7 +888,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();
|
||||
}
|
||||
@@ -1096,7 +1099,7 @@ export function getOverlayPaintRect(sourceId, entryId) {
|
||||
/**
|
||||
* Opacity an entry paints with this frame, or 0 when it is not queued or the
|
||||
* yield-collision pass hid it. Custom lanes may call it before later lanes
|
||||
* publish paint rects. Leaves out the Cyber sonar fade.
|
||||
* publish paint rects. Leaves out the sonar fade.
|
||||
* @param {string} sourceId
|
||||
* @param {string} entryId
|
||||
* @returns {number}
|
||||
@@ -2786,10 +2789,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;
|
||||
}
|
||||
@@ -2871,6 +2873,8 @@ export function initWorldOverlay(viewer) {
|
||||
};
|
||||
window.addEventListener('gev:cockpit-mode-changed', _cockpitModeHandler);
|
||||
_removePostRender = frame.on('postRender', () => drawWorldOverlay());
|
||||
// Click handlers read the card painted on top through the pick registry.
|
||||
setClickCardHitTest(hitTestWorldOverlay);
|
||||
_removeMoveEnd = camera.on('moveEnd', () => invalidateHost());
|
||||
installUiOccluderObservers();
|
||||
// The backing store and the occluder inventory are both deferred to the
|
||||
@@ -2956,6 +2960,7 @@ export function destroyWorldOverlay() {
|
||||
_paintCount = 0;
|
||||
_paintRectCount = 0;
|
||||
_hitRectCount = 0;
|
||||
setClickCardHitTest(null);
|
||||
_uiOcclusionRects.length = 0;
|
||||
_uiOcclusionRectPool.length = 0;
|
||||
_destroyed = hadHost || _destroyed;
|
||||
|
||||
@@ -1941,6 +1941,25 @@ test('paint rectangles publish from a pool and topmost interactive lookup wins',
|
||||
env.cleanup();
|
||||
});
|
||||
|
||||
test('hit rectangles stay what is painted until the next paint, through a republish in the same click', () => {
|
||||
const env = installMockEnvironment();
|
||||
initWorldOverlay(env.viewer);
|
||||
setOverlayEntries('cards', [selectedEntry('card', { interactive: true })]);
|
||||
env.postRender.raise();
|
||||
assert.equal(hitTestWorldOverlay(200, 120)?.entryId, 'card');
|
||||
// An earlier click subscriber publishes its own selection card: later
|
||||
// subscribers in the same click still see what the user clicked on.
|
||||
setOverlayEntries('other', [selectedEntry('elsewhere', { interactive: true })]);
|
||||
clearOverlaySource('cards');
|
||||
assert.equal(hitTestWorldOverlay(200, 120)?.entryId, 'card');
|
||||
assert.equal(hitTestWorldOverlay(200, 120, { sourceId: 'cards' })?.entryId, 'card');
|
||||
// The next paint shows the change, and the hit test follows it.
|
||||
env.postRender.raise();
|
||||
assert.equal(hitTestWorldOverlay(200, 120, { sourceId: 'cards' }), null);
|
||||
assert.equal(hitTestWorldOverlay(200, 120)?.entryId, 'elsewhere');
|
||||
env.cleanup();
|
||||
});
|
||||
|
||||
test('CCTV stable frame slots gate ambient chrome and wire the exact host hit rectangle', () => {
|
||||
const env = installMockEnvironment({ width: 500, height: 400, dpr: 1 });
|
||||
initWorldOverlay(env.viewer);
|
||||
|
||||
Reference in new issue
Block a user