mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-20 10:12:18 +00:00
fix(cctv): a count click yields to what is on top and keeps its group in frame
- A count click stands aside when an overlay label or another layer's card already took the click, and CCTV now claims a count click in the shared pick registry, so the flights layer no longer reads it as an empty-map click and keeps tracking its aircraft. - The flight to a group halves the distance only while the group stays in frame; otherwise it flies to the nearest ground cell of the group, so a tilted click no longer ends with no camera on screen. - Counts hidden under the HUD no longer push the active icon aside, and a lone camera that would move a merged count under the HUD leaves the original count and its icon as they were. - Cameras on one mount are spread before counts merge, so a spread icon no longer slides under a neighbouring count. - The ground module comment says how a camera without a batch height takes the drawn terrain.
This commit is contained in:
1 parent
2b7a6b0c63
commit
f6982dc934
16 files changed
+452
-70
No files matched your search
@@ -3,6 +3,7 @@ import {
|
||||
cellLonLat,
|
||||
formatCameraCount,
|
||||
mergeCountCells,
|
||||
withoutLoneCameras,
|
||||
} from '../../data/cctvCellCounts.js';
|
||||
import { WORLD_OVERLAY_STYLE } from '../../overlays/worldOverlayTokens.js';
|
||||
import {
|
||||
@@ -200,7 +201,27 @@ export function createCountMarkers(
|
||||
ground(visible);
|
||||
let changed = visible.length !== markers.length;
|
||||
for (let i = 0; i < visible.length; i++) {
|
||||
const cell = visible[i];
|
||||
let cell = visible[i];
|
||||
// If the merged count is under the HUD, restore the count and its lone icons.
|
||||
if (hardUi && cell.lone?.length) {
|
||||
const at = project(cellCenter(cell));
|
||||
const { width, height } = sizeFor(cell.count);
|
||||
const rect = at && {
|
||||
x: at.x - width / 2,
|
||||
y: at.y - height / 2,
|
||||
w: width,
|
||||
h: height,
|
||||
};
|
||||
if (rect && hardUi(rect)) {
|
||||
for (const lone of cell.lone) lone.absorbed = false;
|
||||
const core = withoutLoneCameras(cell);
|
||||
if (core) {
|
||||
core.releasedAt = rect;
|
||||
ground([core]);
|
||||
cell = core;
|
||||
}
|
||||
}
|
||||
}
|
||||
const marker = (markers[i] ??= { focus: 1 });
|
||||
const last = marker.cell;
|
||||
const size = sizeFor(cell.count);
|
||||
@@ -217,20 +238,6 @@ export function createCountMarkers(
|
||||
marker.hudHidden = undefined;
|
||||
changed = true;
|
||||
}
|
||||
// A count hidden by the HUD leaves its lone cameras visible as icons.
|
||||
if (hardUi && cell.lone?.length) {
|
||||
const at = project(marker.pos);
|
||||
if (
|
||||
at &&
|
||||
hardUi({
|
||||
x: at.x - size.width / 2,
|
||||
y: at.y - size.height / 2,
|
||||
w: size.width,
|
||||
h: size.height,
|
||||
})
|
||||
)
|
||||
for (const lone of cell.lone) lone.absorbed = false;
|
||||
}
|
||||
changed ||=
|
||||
size.text !== marker.text ||
|
||||
size.width !== marker.width ||
|
||||
@@ -267,6 +274,8 @@ export function createCountMarkers(
|
||||
ctx.textBaseline = 'middle';
|
||||
for (let i = 0; i < markers.length; i++) {
|
||||
const marker = markers[i];
|
||||
// The core can stay visible while the HUD uncovers the merged count.
|
||||
if (marker.cell.releasedAt) refresh ||= !hardUi(marker.cell.releasedAt);
|
||||
const { height } = marker;
|
||||
const { x: px, y: py, z: pz } = marker.pos;
|
||||
const w = m[3] * px + m[7] * py + m[11] * pz + m[15];
|
||||
@@ -291,12 +300,14 @@ export function createCountMarkers(
|
||||
)
|
||||
continue;
|
||||
const hidden = Boolean(hardUi?.(rect));
|
||||
if (marker.hudHidden !== hidden) {
|
||||
const previous = marker.hudHidden;
|
||||
if (previous !== hidden) {
|
||||
marker.hudHidden = hidden;
|
||||
// A first frame or moving HUD can change which lone icons must show.
|
||||
refresh ||= marker.cell.lone?.some(
|
||||
(cell) => cell.absorbed === hidden,
|
||||
);
|
||||
// The active icon steps aside only for visible counts.
|
||||
refresh ||=
|
||||
hidden ||
|
||||
previous !== undefined ||
|
||||
marker.cell.lone?.some((cell) => cell.absorbed === hidden);
|
||||
}
|
||||
if (hidden) continue;
|
||||
const fade =
|
||||
|
||||
Reference in new issue
Block a user