fix(picking): arbitrate card clicks over passive and background shapes

Flight trails register their ids so every layer reads a trail click as a
no-op, and the directions route claims its line and markers though it acts
only on its maneuver steps. The quake card and magnitude labels yielded to
any registered owner, so over a trail or a route they did nothing. Pick
owners can now name the picks they never act on (registerPickOwner(...,
{ passive })); isActedOnByOtherLayer leaves those out while
isOwnedByOtherLayer is unchanged, so they are still not empty space.

Submarine cables and rocket launches acted on any scene pick, so a card or
label over a cable or a launch marker made both layers act. Both now stand
aside when a world-overlay entry is under the click, as drone airspace and
fire perimeters do through the top-entry check. Each of these layers, and
the quake discs, registers its shapes with registerCardBackground. CCTV
asks isCardBackground instead of matching other layers' set and id formats,
so a live top CCTV card acts once over any of them, while unknown
identified objects and registered owners still block it.
This commit is contained in:
manjunath22466 committed 2026-11-17 01:33:06 +05:30
1 parent 836daf82b3
commit 133d022b29
23 files changed
+825 -78

No files matched your search

+41
View File
@@ -28,6 +28,8 @@ import {
createApplicationDirectionsLayer,
} from './directions.js';
import { GROUND_FLOOR_LIFT_M } from './groundFloor.js';
import { isActedOnByOtherLayer, isOwnedByOtherLayer } from './pickRegistry.js';
import { fakeInput } from '../input/testDoubles.mjs';
import { instructionFor } from './routeSteps.js';
import { setLocale } from '../i18n/index.js';
import {
@@ -465,6 +467,45 @@ function ownershipFixture(t) {
});
}
// Directions acts only on its maneuver steps. The route line and the A/B
// markers are passive picks: still not empty space to other layers, but a
// card painted over them (a quake card) keeps its click.
test('enabled, directions owns its picks and acts only on its steps', (t) => {
ownershipFixture(t);
const viewer = {
scene: {
pick: () => null,
canvas: { clientWidth: 100, clientHeight: 100 },
},
};
const input = fakeInput(viewer);
t.after(() => input.destroy());
directionsLayer.enable(viewer);
try {
for (const id of [
'directions:route',
'directions:marker:a',
'directions:step:3',
])
assert.equal(isOwnedByOtherLayer('earthquakes', id), true, id);
assert.equal(
isActedOnByOtherLayer('earthquakes', 'directions:route'),
false,
);
assert.equal(
isActedOnByOtherLayer('earthquakes', 'directions:marker:a'),
false,
);
assert.equal(
isActedOnByOtherLayer('earthquakes', 'directions:step:3'),
true,
);
} finally {
directionsLayer.disable(viewer);
}
assert.equal(isOwnedByOtherLayer('earthquakes', 'directions:route'), false);
});
test('placing an endpoint takes the pointer, and every exit path gives it back', (t) => {
ownershipFixture(t);