mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-20 18:22:25 +00:00
fix(cctv): settle the review of the count markers
Bugs: - Cameras on one mount stay side by side after their geometry is built, so a click or a settled view no longer folds them back into one icon. - A count click yields to a card drawn over the marker and to another layer's object under it, waits while the cockpit or tracking holds the view, and flies at most halfway, so a long chain of cameras still splits. - The active camera's icon is never covered by a count, transparent corners of the marker no longer catch clicks, and a count hidden under the HUD keeps its lone cameras. - A lone camera joins only its nearest count and never bridges two; cameras close enough to draw as icons take part too, at their drawn icon size. - Groups across the antimeridian keep their longitude; the flight frames the highest mount; markers on ground below the ellipsoid stay visible; counts fade outside the Scope circle. - Mounts less than a metre apart count as one mount. - A drawn-terrain height survives a late fallback answer, is read for an unresolved camera and for one projected off the window, is re-read when the terrain under it finishes loading or the terrain source changes, and the read budget no longer goes to the same misses each pass. Cleanup: the glyph draws from one green SVG sprite instead of recolouring pixels, marker-only constants move next to their use, layout tests check behaviour rather than formulas, and docs and comments match the code. docs/I18N.md names the one fixed notation of count badges as an exception.
This commit is contained in:
1 parent
2e18673df8
commit
81fe7f88cc
26 files changed
+1608
-638
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import * as picking from '../../data/pickRegistry.js';
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { CCTV_ACTIVATION_RESULT } from '../../cctvFocusRequest.js';
|
||||
@@ -103,3 +104,49 @@ test('a count click preserves the provisional opening pick until the view settle
|
||||
unbind();
|
||||
}
|
||||
});
|
||||
|
||||
test("a count click yields to a card above it and to another layer's object, not to a CCTV icon", () => {
|
||||
let zooms = 0,
|
||||
clicks = 0;
|
||||
const selection = createSelection({
|
||||
services: { activation: {}, picking },
|
||||
state: {
|
||||
_enabled: true,
|
||||
_counts: { pickedCell: () => ({}) },
|
||||
_cctvOverlayHost: {
|
||||
hitTest: (x) => (x === 14 ? { entryId: 'cam-1' } : null),
|
||||
},
|
||||
},
|
||||
parts: {
|
||||
navigation: { zoomToCell: () => zooms++ },
|
||||
rendering: {
|
||||
extractPickedCameraId: (hit) =>
|
||||
hit?.set === 'cctv-icons' ? hit.id : null,
|
||||
},
|
||||
},
|
||||
});
|
||||
const click = selection.bindCctvWorldClickGesture(
|
||||
{ onClick: (fn) => fn },
|
||||
() => clicks++,
|
||||
);
|
||||
picking.registerPickOwner('cctv', (id) => id.startsWith('cam-'));
|
||||
try {
|
||||
for (const [x, topHit, expected] of [
|
||||
[14, null, [0, 1]],
|
||||
[20, { set: 'flights', id: 'abc' }, [0, 2]],
|
||||
[20, { set: 'cctv-icons', id: 'cam-2' }, [1, 2]],
|
||||
[20, null, [2, 2]],
|
||||
[20, { set: 'flights', id: 'cam-2' }, [2, 3]],
|
||||
]) {
|
||||
click({
|
||||
screenPosition: { x, y: 26 },
|
||||
topHit,
|
||||
drawHit: topHit,
|
||||
gesture: { travelPx: 0, durationMs: 20 },
|
||||
});
|
||||
assert.deepEqual([zooms, clicks], expected);
|
||||
}
|
||||
} finally {
|
||||
picking.unregisterPickOwner('cctv');
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user