mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 17:52: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
@@ -78,8 +78,11 @@ export function createLifecycle({
|
||||
* answers a detection record from the same source, or null) selects it
|
||||
* and moves the camera to it as a click on its marker does, the selected
|
||||
* fire's card shows, and a click on empty space clears the selection.
|
||||
* Its optional `focusRangeM(record)` gives how far, in metres, the camera
|
||||
* stands from a fire it draws when moving to it, for fires drawn larger
|
||||
* than a marker; without one, or for null, the usual fire framing holds.
|
||||
* `null` brings the markers back. The selection is kept either way.
|
||||
* @param {?{hitTest: (screenPosition: {x: number, y: number}) => ?Object}} standIn
|
||||
* @param {?{hitTest: (screenPosition: {x: number, y: number}) => ?Object, focusRangeM?: (record: Object) => ?number}} standIn
|
||||
*/
|
||||
setMarkerStandIn(standIn) {
|
||||
layerState._standIn =
|
||||
|
||||
@@ -77,11 +77,15 @@ export function createSelection({
|
||||
|
||||
function selectAndFocusFire(fire) {
|
||||
selectFire(fire);
|
||||
// A stand-in that draws the fire larger than a marker says how far the
|
||||
// camera stands from it (`setMarkerStandIn`).
|
||||
const rangeM = layerState._standIn?.focusRangeM?.(fire);
|
||||
requestWorldFocus({
|
||||
kind: 'fire',
|
||||
id: fireDetectionKey(fire),
|
||||
label: t('FIRE'),
|
||||
position: components.model.firePosition(fire),
|
||||
...(Number.isFinite(rangeM) && rangeM > 0 ? { rangeM } : {}),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user