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
@@ -136,7 +136,8 @@ function visitNeighbors(marker, grid, gap, visit) {
|
||||
* one grid bucket. Even the widest pill can only touch its eight neighbors.
|
||||
* A cell with one camera takes the footprint `sizeFor(1)` gives its icon and
|
||||
* joins the nearest count it touches. Lone cameras never join each other
|
||||
* or bridge two counts.
|
||||
* or bridge two counts. A spread icon's `offsetPx` shifts its footprint sideways.
|
||||
* A merged group lists its ground cells in `parts`.
|
||||
* Ground cells stay intact for the camera picker and individual-icon pass.
|
||||
*/
|
||||
export function mergeCountCells(cells, project, sizeFor, gap) {
|
||||
@@ -150,7 +151,7 @@ export function mergeCountCells(cells, project, sizeFor, gap) {
|
||||
// The view projector reuses its result object.
|
||||
return {
|
||||
cell,
|
||||
x: screen?.x,
|
||||
x: screen ? screen.x + (cell.offsetPx ?? 0) : undefined,
|
||||
y: screen?.y,
|
||||
halfSegment: (width - height) / 2,
|
||||
radius: height / 2,
|
||||
@@ -201,8 +202,10 @@ export function mergeCountCells(cells, project, sizeFor, gap) {
|
||||
} else {
|
||||
const group = createCameraCell(seed.cell.key);
|
||||
group.lone = [];
|
||||
group.parts = [];
|
||||
for (const { cell } of members) {
|
||||
addCell(group, cell);
|
||||
group.parts.push(...(cell.parts ?? [cell]));
|
||||
if (cell.count === 1) group.lone.push(cell);
|
||||
else if (cell.lone) group.lone.push(...cell.lone);
|
||||
}
|
||||
@@ -218,3 +221,13 @@ export function mergeCountCells(cells, project, sizeFor, gap) {
|
||||
}
|
||||
return groups;
|
||||
}
|
||||
|
||||
/** Rebuild a group's count under its original key, excluding lone cameras. */
|
||||
export function withoutLoneCameras(group) {
|
||||
const counts = (group.parts ?? []).filter((cell) => cell.count > 1);
|
||||
if (!counts.length) return null;
|
||||
const core = createCameraCell(group.key);
|
||||
core.parts = counts;
|
||||
for (const cell of counts) addCell(core, cell);
|
||||
return core;
|
||||
}
|
||||
Reference in new issue
Block a user