From 4c5afdd3a44d7976e96471bbfaacdce7b7388f9c Mon Sep 17 00:00:00 2001 From: vodyanoysh Date: Tue, 31 Mar 2026 22:48:02 +0700 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=BB=D1=83=D1=87=D1=88=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20pull-to-refresh:=20=D1=87=D1=83=D0=B2=D1=81=D1=82?= =?UTF-8?q?=D0=B2=D0=B8=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D1=8C,=20=D0=B4=D0=B8=D1=81=D1=82=D0=B0=D0=BD=D1=86=D0=B8?= =?UTF-8?q?=D1=8F,=20=D0=B0=D0=BD=D0=B8=D0=BC=D0=B0=D1=86=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Порог увеличен 64 → 130px, чувствительность снижена 0.45 → 0.16 - Rubber-band: сопротивление нарастает по мере приближения к порогу - Иконка вращается 0–270° пропорционально прогрессу тяги - Цвет плавно переходит от muted к accent через color-mix - При достижении порога — accent glow на border-bottom - Snap-back с cubic-bezier только при отпускании (pullReleasing) - Игнорирование trackpad-шума (delta < 4px) Co-Authored-By: Claude Sonnet 4.6 --- .../src/components/messages/MessageList.vue | 93 ++++++++++++++----- 1 file changed, 71 insertions(+), 22 deletions(-) diff --git a/src/renderer/src/components/messages/MessageList.vue b/src/renderer/src/components/messages/MessageList.vue index 4aa80d4..b086d86 100644 --- a/src/renderer/src/components/messages/MessageList.vue +++ b/src/renderer/src/components/messages/MessageList.vue @@ -42,24 +42,35 @@ onMounted(restartAutoCheck) onUnmounted(() => { if (autoCheckTimer) clearInterval(autoCheckTimer) }) // ── Pull-to-refresh ─────────────────────────────────────── -const PULL_THRESHOLD = 64 -const pullY = ref(0) +const PULL_THRESHOLD = 130 // расстояние для срабатывания +const PULL_FACTOR = 0.16 // базовая чувствительность +const PULL_RUBBER = 0.55 // rubber-band: сопротивление у порога + +const pullY = ref(0) const pullRefreshing = ref(false) +const pullReleasing = ref(false) + const indicatorProgress = computed(() => pullRefreshing.value ? 1 : Math.min(1, pullY.value / PULL_THRESHOLD) ) +const iconRotate = computed(() => indicatorProgress.value * 270) let pullDecayTimer: ReturnType | null = null function onWheel(event: WheelEvent): void { const el = event.currentTarget as HTMLElement if (el.scrollTop > 2) { - if (pullY.value > 0) pullY.value = 0 + if (pullY.value > 0) { pullY.value = 0 } return } + const delta = Math.abs(event.deltaY) + if (delta < 4) return // trackpad-шум + if (event.deltaY < 0 && !pullRefreshing.value && !messagesStore.loading) { if (pullDecayTimer) { clearTimeout(pullDecayTimer); pullDecayTimer = null } - pullY.value = Math.min(PULL_THRESHOLD, pullY.value + Math.abs(event.deltaY) * 0.45) + // rubber-band: чем ближе к порогу — тем тяжелее тянуть + const resistance = 1 - (pullY.value / PULL_THRESHOLD) * PULL_RUBBER + pullY.value = Math.min(PULL_THRESHOLD, pullY.value + delta * PULL_FACTOR * resistance) if (pullY.value >= PULL_THRESHOLD) triggerPullRefresh() } else if (event.deltaY > 0 && pullY.value > 0) { schedulePullDecay() @@ -68,7 +79,11 @@ function onWheel(event: WheelEvent): void { function schedulePullDecay(): void { if (pullDecayTimer) clearTimeout(pullDecayTimer) - pullDecayTimer = setTimeout(() => { pullY.value = 0 }, 180) + pullDecayTimer = setTimeout(() => { + pullReleasing.value = true + pullY.value = 0 + setTimeout(() => { pullReleasing.value = false }, 320) + }, 250) } async function triggerPullRefresh(): Promise { @@ -76,8 +91,10 @@ async function triggerPullRefresh(): Promise { pullRefreshing.value = true pullY.value = PULL_THRESHOLD await refresh() + pullReleasing.value = true pullRefreshing.value = false pullY.value = 0 + setTimeout(() => { pullReleasing.value = false }, 320) } // ── Scroll (infinite load) ──────────────────────────────── @@ -178,10 +195,21 @@ async function handleSwipeAction(action: SwipeAction, messageId: string): Promis
-
- +
+
+ +
{{ pullRefreshing ? 'Обновление...' : indicatorProgress >= 1 ? 'Отпустите для обновления' : 'Потяните для обновления' }}
@@ -603,38 +631,59 @@ async function handleSwipeAction(action: SwipeAction, messageId: string): Promis /* Pull-to-refresh */ .pull-indicator-wrap { - height: calc(var(--progress, 0) * 44px); + height: calc(var(--progress, 0) * 56px); overflow: hidden; flex-shrink: 0; - transition: height 0.12s ease; +} +.pull-indicator-wrap.releasing { + transition: height 0.32s cubic-bezier(0.25, 0.46, 0.45, 0.94); } .pull-indicator { - height: 44px; + height: 56px; display: flex; align-items: center; justify-content: center; - gap: 7px; - font-size: 11px; + gap: 8px; + font-size: 11.5px; font-weight: 500; - color: var(--text-muted); + /* цвет интерполируется от muted к accent по мере тяги */ + color: color-mix(in srgb, var(--accent) calc(var(--pull-progress, 0) * 100%), var(--text-muted)); background: - linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.01) 100%), - rgba(12, 12, 20, 0.5); - backdrop-filter: blur(12px); - -webkit-backdrop-filter: blur(12px); + linear-gradient(180deg, rgba(255,255,255,0.045) 0%, rgba(255,255,255,0.012) 100%), + rgba(10, 10, 18, 0.65); + backdrop-filter: blur(20px) saturate(1.5); + -webkit-backdrop-filter: blur(20px) saturate(1.5); border-bottom: 1px solid rgba(255, 255, 255, 0.06); - box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07); letter-spacing: 0.2px; + transition: color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease; } -.pull-indicator svg { - transition: transform 0.2s ease; - color: var(--text-muted); +/* Достигнут порог — accent-подсветка */ +.pull-indicator.ready { + border-bottom-color: color-mix(in srgb, var(--accent) 35%, transparent); + box-shadow: + inset 0 1px 0 rgba(255, 255, 255, 0.09), + 0 2px 16px color-mix(in srgb, var(--accent) 10%, transparent); } -.pull-indicator.refreshing svg { +.pull-indicator.refreshing { color: var(--accent); + border-bottom-color: color-mix(in srgb, var(--accent) 25%, transparent); +} + +/* Обёртка иконки: вращение по прогрессу */ +.pull-icon-outer { + display: flex; + align-items: center; + justify-content: center; + flex-shrink: 0; + transition: transform 0.06s linear; +} +.pull-icon-outer.spinning { + animation: spin 0.7s linear infinite; + transition: none; } @keyframes spin {