mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
fix(earthquakes, cyclones): an item that goes takes its double-click follow with it
Removing a followed entity ended the default renderer's follow. A disc gone from the feed, or a storm point gone from the advisory (or a cleared one), now ends it too.
This commit is contained in:
1 parent
def2e1ecca
commit
fbc40ef3b6
6 files changed
+46
-2
No files matched your search
+11
-1
@@ -100,7 +100,8 @@ export function followViewFrom(sphere, at, camera) {
|
||||
* radius 0 by default, and the holder whose entity record shows it, as
|
||||
* `entityFollowTarget` reads one), or zoomed to (`zoomTo`); null for
|
||||
* anything else.
|
||||
* @returns {{readonly following: object|null, stop(): void, destroy(): void}}
|
||||
* @returns {{readonly following: object|null, retain(drawn: (key: string) => boolean): void,
|
||||
* stop(): void, destroy(): void}}
|
||||
*/
|
||||
export function followOnDoubleClick({
|
||||
viewer,
|
||||
@@ -160,6 +161,15 @@ export function followOnDoubleClick({
|
||||
get following() {
|
||||
return follow && findCamera(viewer)?.followed === follow ? follow : null;
|
||||
},
|
||||
/**
|
||||
* Stop a follow this started of something no longer drawn, as removing
|
||||
* an entity ended the default renderer's follow of it.
|
||||
* @param {(key: string) => boolean} drawn Whether the item keyed so is.
|
||||
*/
|
||||
retain(drawn) {
|
||||
const key = this.following?.key;
|
||||
if (key && !drawn(key)) this.stop();
|
||||
},
|
||||
/** Stop a follow this started, if the camera still keeps it. */
|
||||
stop() {
|
||||
const camera = findCamera(viewer);
|
||||
|
||||
Reference in new issue
Block a user