mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-14 15:22:21 +00:00
fix(cockpit): a ship's double-click memory belongs to that ship
The first press's picture of the ship survived a change of followed subject: following an aircraft (or another ship) within 700 ms let a double-click on the old ship's spot enter the new subject. The memory now carries the ship's MMSI and is used only while that ship is still the one followed.
This commit is contained in:
1 parent
f96a89a9ef
commit
5c937e67e1
2 files changed
+28
-1
No files matched your search
@@ -81,7 +81,8 @@ export function onScenePointerDown(nowMs = performance.now()) {
|
||||
return;
|
||||
}
|
||||
const at = subjectCanvasPosition.call(this);
|
||||
this.doubleClickStart = at ? { x: at.x, y: at.y, atMs: nowMs } : null;
|
||||
const mmsi = this.readVesselInfo()?.mmsi ?? null;
|
||||
this.doubleClickStart = at ? { x: at.x, y: at.y, atMs: nowMs, mmsi } : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,6 +106,10 @@ export function onSceneDoubleClick(position, nowMs = performance.now()) {
|
||||
doubleClickHitsSubject(position, subjectCanvasPosition.call(this)) ||
|
||||
(Boolean(start) &&
|
||||
nowMs - start.atMs <= DOUBLE_CLICK_MEMORY_MS &&
|
||||
// The memory is the ship's it was taken for: one followed since (an
|
||||
// aircraft, another ship) is hit only where it is drawn.
|
||||
this.resolveEntryKind() === 'vessel' &&
|
||||
start.mmsi === (this.readVesselInfo()?.mmsi ?? null) &&
|
||||
doubleClickHitsSubject(position, start));
|
||||
if (!hit) return false;
|
||||
this.enter();
|
||||
|
||||
Reference in new issue
Block a user