fix(zoom): hold connected zoom before handoff

This commit is contained in:
webadderall committed 2026-06-02 20:23:58 +10:00
1 parent cfd5d5a8de
commit 4e9d9f8bc4
2 files changed
+13 -3

No files matched your search

@@ -400,7 +400,7 @@ describe("findDominantRegion", () => {
const result = findDominantRegion(regions, 3100, { connectZooms: true });
expect(result.transition).toBeNull();
expect(result.region?.id).toBe("a");
expect(result.strength).toBeGreaterThan(0);
expect(result.strength).toBe(1);
});
it("keeps the incoming region at full strength after a connected handoff", () => {
@@ -124,8 +124,18 @@ function getActiveRegion(
const activeRegions = regions
.map((region) => {
const outgoingPair = connectedPairs.find((pair) => pair.currentRegion.id === region.id);
if (outgoingPair && timeMs >= outgoingPair.transitionStart) {
return { region, strength: 0 };
if (outgoingPair) {
if (timeMs >= outgoingPair.transitionStart) {
return { region, strength: 0 };
}
const zoomOutStart =
outgoingPair.currentRegion.endMs -
ZOOM_OUT_EARLY_START_MS +
ZOOM_ANIMATION_LEAD_MS;
if (timeMs >= zoomOutStart) {
return { region, strength: 1 };
}
}
const incomingPair = connectedPairs.find((pair) => pair.nextRegion.id === region.id);