fix: restore signs after navigation
This commit is contained in:
@@ -52,7 +52,7 @@ export function createSignController(): SignController {
|
||||
let lastNow: number | null = null;
|
||||
let generation = 0;
|
||||
let pendingTargetId: SectionId | null = null;
|
||||
const completedTargets = new Set<SectionId>();
|
||||
const completedTraversalTargets = new Set<SectionId>();
|
||||
|
||||
const reset = (now?: number): void => {
|
||||
generation += 1;
|
||||
@@ -104,7 +104,7 @@ export function createSignController(): SignController {
|
||||
if (visible.departStartedAt !== null) {
|
||||
const progress = clamp01((now - visible.departStartedAt) / SIGN_LIFECYCLE.departMs);
|
||||
if (progress >= 1) {
|
||||
if (visible.dwellStartedAt !== null) completedTargets.add(visible.targetId);
|
||||
if (visible.dwellStartedAt !== null) completedTraversalTargets.add(visible.targetId);
|
||||
state = {
|
||||
kind: 'cooldown',
|
||||
until: visible.departStartedAt
|
||||
@@ -165,7 +165,7 @@ export function createSignController(): SignController {
|
||||
|
||||
if (input.crossedBoundaries > 0) {
|
||||
const route = signRouteFor(input.activeSectionId);
|
||||
return route.eligible && !completedTargets.has(route.id) ? route.id : null;
|
||||
return route.eligible && !completedTraversalTargets.has(route.id) ? route.id : null;
|
||||
}
|
||||
if (
|
||||
input.candidateId === null
|
||||
@@ -176,7 +176,7 @@ export function createSignController(): SignController {
|
||||
const route = signRouteFor(input.candidateId);
|
||||
return route.eligible
|
||||
&& input.candidateDistanceVh <= route.triggerMaximumVh
|
||||
&& !completedTargets.has(route.id)
|
||||
&& !completedTraversalTargets.has(route.id)
|
||||
? route.id
|
||||
: null;
|
||||
};
|
||||
@@ -190,8 +190,7 @@ export function createSignController(): SignController {
|
||||
|
||||
if (!input.motionAllowed || input.source !== 'passive-scroll') {
|
||||
if (input.source !== 'passive-scroll') {
|
||||
const route = signRouteFor(input.activeSectionId);
|
||||
if (route.eligible) completedTargets.add(route.id);
|
||||
completedTraversalTargets.clear();
|
||||
}
|
||||
reset(input.now);
|
||||
return null;
|
||||
@@ -206,7 +205,7 @@ export function createSignController(): SignController {
|
||||
if (candidate !== null) pendingTargetId = candidate;
|
||||
if (input.now < state.until) return null;
|
||||
state = { kind: 'idle' };
|
||||
if (pendingTargetId !== null && !completedTargets.has(pendingTargetId)) {
|
||||
if (pendingTargetId !== null && !completedTraversalTargets.has(pendingTargetId)) {
|
||||
const targetId = pendingTargetId;
|
||||
pendingTargetId = null;
|
||||
state = latch(
|
||||
|
||||
Reference in New Issue
Block a user