fix: allow adjacent month pull on short lists

This commit is contained in:
openclaw 2026-07-25 01:50:50 +08:00
parent 50779dffff
commit 39bf725200
1 changed files with 12 additions and 4 deletions

View File

@ -238,8 +238,8 @@ function startLedgerPull(event: TouchEvent) {
const touch = event.touches[0]; const touch = event.touches[0];
if (!content || !touch) return; if (!content || !touch) return;
const atTop = content.scrollTop <= 0; const atTop = content.scrollTop <= 0;
const atBottom = content.scrollHeight > content.clientHeight + 4 const isShortList = content.scrollHeight <= content.clientHeight + 4;
&& content.scrollTop + content.clientHeight >= content.scrollHeight - 2; const atBottom = isShortList || content.scrollTop + content.clientHeight >= content.scrollHeight - 2;
pullEdge.value = atTop ? "top" : atBottom ? "bottom" : null; pullEdge.value = atTop ? "top" : atBottom ? "bottom" : null;
pullStartY.value = pullEdge.value ? touch.clientY : null; pullStartY.value = pullEdge.value ? touch.clientY : null;
pullDistance.value = 0; pullDistance.value = 0;
@ -251,13 +251,21 @@ function moveLedgerPull(event: TouchEvent) {
const touch = event.touches[0]; const touch = event.touches[0];
const content = ledgerContent.value; const content = ledgerContent.value;
if (startY === null || !edge || !touch || !content) return; if (startY === null || !edge || !touch || !content) return;
const delta = edge === "top" ? touch.clientY - startY : startY - touch.clientY; const isShortList = content.scrollHeight <= content.clientHeight + 4;
if (isShortList && edge === "top" && touch.clientY < startY) {
pullEdge.value = "bottom";
} else if (isShortList && edge === "bottom" && touch.clientY > startY) {
pullEdge.value = "top";
}
const activeEdge = pullEdge.value;
if (!activeEdge) return;
const delta = activeEdge === "top" ? touch.clientY - startY : startY - touch.clientY;
if (delta <= 0) { if (delta <= 0) {
pullDistance.value = 0; pullDistance.value = 0;
return; return;
} }
pullDistance.value = Math.min(144, delta * 0.55); pullDistance.value = Math.min(144, delta * 0.55);
if (edge === "bottom") { if (activeEdge === "bottom") {
requestAnimationFrame(() => { requestAnimationFrame(() => {
const current = ledgerContent.value; const current = ledgerContent.value;
if (current && pullEdge.value === "bottom") { if (current && pullEdge.value === "bottom") {