fix(story): harden notebook interaction and fallback

This commit is contained in:
Evandro Fonseca Junior committed 2026-08-31 01:28:43 -03:00
1 parent bb4bf8e7e2
commit f3ed9da777
12 files changed
+344 -57

No files matched your search

+16 -3
View File
@@ -81,6 +81,7 @@ function getCursorPoint(
progress: number,
phase: NotebookPhase,
activeTabIndex: number,
tabCount: number,
): { x: number; y: number } {
if (phase === "cursor-in") {
const cursorProgress = (progress - 0.34) / 0.1;
@@ -94,8 +95,19 @@ function getCursorPoint(
return { x: 0.06, y: 0.88 };
}
const point = CURSOR_POINTS[activeTabIndex % CURSOR_POINTS.length];
return point;
const target = CURSOR_POINTS[activeTabIndex % CURSOR_POINTS.length];
if (phase !== "browse" || activeTabIndex === 0) return target;
const browseProgress =
(progress - BROWSE_START) / (BROWSE_END - BROWSE_START);
const slotProgress = browseProgress * tabCount - activeTabIndex;
const previous = CURSOR_POINTS[(activeTabIndex - 1) % CURSOR_POINTS.length];
const moveProgress = clamp(slotProgress / 0.36, 0, 1);
return {
x: interpolate(previous.x, target.x, moveProgress),
y: interpolate(previous.y, target.y, moveProgress),
};
}
function isCursorClicking(
@@ -124,7 +136,7 @@ function isCursorClicking(
const browseProgress =
(progress - BROWSE_START) / (BROWSE_END - BROWSE_START);
const slotProgress = (browseProgress * tabCount) % 1;
return slotProgress < 0.12;
return slotProgress >= 0.36 && slotProgress < 0.5;
}
export function getNotebookFrame(
@@ -173,6 +185,7 @@ export function getNotebookFrame(
normalizedProgress,
phase,
activeTabIndex,
normalizedTabCount,
);
return {