mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 09:42:21 +00:00
feat(firms): a marker stand-in can set how far the camera stands from a fire it draws (#1832)
setMarkerStandIn takes an optional focusRangeM(record): when a click on a fire the stand-in draws moves the camera there, it stands off that many metres instead of the usual fire framing. A world focus request may carry its own rangeM; past the framed radius it replaces the kind's range.
This commit is contained in:
1 parent
0a9235cc69
commit
cd144ecad5
6 files changed
+63
-3
No files matched your search
@@ -698,6 +698,7 @@ test('a click on a fire an application draws in place of the markers selects it
|
||||
fireDetectionKey(fire),
|
||||
'the stand-in decides, not the hidden glow under the click',
|
||||
);
|
||||
assert.equal('rangeM' in h.requests[0], false, 'the usual fire framing');
|
||||
assert.equal(h.layer.getSelectedInfo().id, fireDetectionKey(fire));
|
||||
assert.equal(getSelectedEntityContext().label, 'Fire · FRP 1520 MW');
|
||||
assert.deepEqual(
|
||||
@@ -716,6 +717,32 @@ test('a click on a fire an application draws in place of the markers selects it
|
||||
}
|
||||
});
|
||||
|
||||
test('a stand-in that draws a fire larger says how far the camera stands from it', () => {
|
||||
const fire = makeFire();
|
||||
const asked = [];
|
||||
let range = 24_000;
|
||||
const h = harness({ fires: [fire] });
|
||||
try {
|
||||
h.layer.setMarkerStandIn({
|
||||
hitTest: () => ({ ...fire }),
|
||||
focusRangeM: (record) => {
|
||||
asked.push(fireDetectionKey(record));
|
||||
return range;
|
||||
},
|
||||
});
|
||||
h.click();
|
||||
assert.deepEqual(asked, [fireDetectionKey(fire)]);
|
||||
assert.equal(h.requests.at(-1).rangeM, 24_000);
|
||||
// No range for this fire: the usual fire framing.
|
||||
range = null;
|
||||
h.click();
|
||||
assert.equal(h.requests.length, 2);
|
||||
assert.equal('rangeM' in h.requests.at(-1), false);
|
||||
} finally {
|
||||
h.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test('a stand-in hit on a fire the layer does not show selects nothing', () => {
|
||||
const fire = makeFire();
|
||||
const h = harness({ fires: [fire] });
|
||||
|
||||
Reference in new issue
Block a user