mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 08:42:21 +00:00
Recent Imagery: drape the next ranked day when the automatic day is empty
When the automatic day probes empty, pruneEmpty() hands it over to the next ranked day and follows that day until its probe answers. The thumbnail subscriber previews a followed day only while it is focused, but focus did not move with the hand-over: autoPreview() sets focus only when there is none, and reconcileFocus() moves focus off a hidden card to the nearest card, not to the next ranked day. With empty days shown, focus stayed on the empty day; with them hidden, it could land on an older neighbour. Either way the successor probed present and never reached the map. autoPreview() now takes the empty automatic day, and focus still on it moves to the successor. Focus the user moved elsewhere stays put. Two layer tests cover both cases; both fail without the change.
This commit is contained in:
1 parent
42540ad85e
commit
def87c4dc0
3 files changed
+38
-6
No files matched your search
@@ -285,12 +285,17 @@ export function createRecentImageryLayer({
|
||||
const rank = (list) =>
|
||||
rankLatest(list.map(withAvailability), { truncated: _truncated });
|
||||
|
||||
/** Focus the START HERE day and preview it when the mode's slot is empty. */
|
||||
function autoPreview() {
|
||||
/**
|
||||
* Focus the START HERE day and preview it when the mode's slot is empty.
|
||||
* @param {string | null} [emptyKey] The empty automatic day handed over;
|
||||
* focus still on it moves too, since a followed day previews only while
|
||||
* it is focused.
|
||||
*/
|
||||
function autoPreview(emptyKey = null) {
|
||||
const ranked = rank(sourcedCandidates());
|
||||
if (!ranked.candidate) return;
|
||||
const key = ranked.candidate.key;
|
||||
if (!_focusKey) _focusKey = key;
|
||||
if (!_focusKey || _focusKey === emptyKey) _focusKey = key;
|
||||
if (!previewSlot() || activeSlotOf(key)) return;
|
||||
_auto = { key, reason: ranked.reason, certain: ranked.certain };
|
||||
if (drapable(candidateFor(key))) _previewKey = key;
|
||||
@@ -317,7 +322,7 @@ export function createRecentImageryLayer({
|
||||
_previewKey = null;
|
||||
_auto = null;
|
||||
changed = true;
|
||||
if (wasAuto) autoPreview();
|
||||
if (wasAuto) autoPreview(preview.key);
|
||||
}
|
||||
// A followed day that turns out empty is dropped; an automatic one hands
|
||||
// over to the next ranked day.
|
||||
@@ -327,7 +332,7 @@ export function createRecentImageryLayer({
|
||||
_followKey = null;
|
||||
if (wasAuto) {
|
||||
_auto = null;
|
||||
autoPreview();
|
||||
autoPreview(followed.key);
|
||||
}
|
||||
changed = true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user