mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 00:32:21 +00:00
fix(rail): focusTrain refuses a train the layer does not draw
A ride let go with restore focuses its train again. When the train's category was turned off during the ride, or for a copy another feed draws, focusTrain selected and followed a train with no marker. It now returns false for a train in a category turned off or hidden as another feed's copy, and leaves the selection and the camera as they are.
This commit is contained in:
1 parent
4ae67fcb35
commit
feaf59776c
2 files changed
+28
-2
No files matched your search
@@ -299,10 +299,12 @@ export function createRailCockpitSubject({
|
||||
/**
|
||||
* Select the train `key` and hand it the camera, as a click on it does.
|
||||
* @param {string} key
|
||||
* @returns {boolean} False for a train the layer does not show.
|
||||
* @returns {boolean} False for a train the layer does not show: gone, in
|
||||
* a category turned off, or a copy another feed draws (dedupe.js).
|
||||
*/
|
||||
focusTrain(key) {
|
||||
if (!state._trains.has(key)) return false;
|
||||
const entry = state._trains.get(key);
|
||||
if (!entry || !parts.rendering.categoryShown(entry)) return false;
|
||||
parts.selection.selectAndFocusTrain(key);
|
||||
return true;
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user