diff --git a/src/renderer/src/components/messages/MessageListItem.vue b/src/renderer/src/components/messages/MessageListItem.vue index 69b37a5..349eae5 100644 --- a/src/renderer/src/components/messages/MessageListItem.vue +++ b/src/renderer/src/components/messages/MessageListItem.vue @@ -31,7 +31,7 @@ const dateDisplay = computed(() => formatMessageDate(props.message.date)) // Constants // ───────────────────────────────────────────────────────────── const CLICK_DIST = 6 // px — max displacement to count as a tap/click -const MIN_DRAG = 12 // px horizontal before we start the visual swipe +const MIN_DRAG = 22 // px horizontal before we start the visual swipe const TRIGGER = 90 // px visual offset → action fires const FLICK_SPEED = 14 // last-event deltaX that counts as a "flick" const FLICK_RATIO = 0.55 // flick trigger = TRIGGER * FLICK_RATIO @@ -40,7 +40,7 @@ const SCALE = 0.50 // visual px per accumulated deltaX past dead zone const RUBBER_PEAK = 72 // visual px where rubber-band starts const RUBBER_K = 0.12 // fraction of excess applied past rubber peak const IDLE_MS = 130 // ms of wheel silence → gesture over -const H_RATIO = 2.0 // deltaX must be ≥ deltaY × H_RATIO to start gesture +const H_RATIO = 1.8 // deltaX must be ≥ deltaY × H_RATIO to start gesture // ───────────────────────────────────────────────────────────── // Reactive / template state @@ -55,10 +55,12 @@ const isSnapping = ref(false) const progress = computed(() => Math.min(1, Math.abs(swipeOffset.value) / TRIGGER)) const showLeftBg = computed(() => swipeOffset.value > 0 && props.swipeRightAction !== 'none') const showRightBg = computed(() => swipeOffset.value < 0 && props.swipeLeftAction !== 'none') -const leftColor = computed(() => SWIPE_ACTION_INFO[props.swipeRightAction].color) -const rightColor = computed(() => SWIPE_ACTION_INFO[props.swipeLeftAction].color) -const leftIcon = computed(() => SWIPE_ACTION_INFO[props.swipeRightAction].icon) -const rightIcon = computed(() => SWIPE_ACTION_INFO[props.swipeLeftAction].icon) +const leftColor = computed(() => SWIPE_ACTION_INFO[props.swipeRightAction].color) +const rightColor = computed(() => SWIPE_ACTION_INFO[props.swipeLeftAction].color) +const leftIcon = computed(() => SWIPE_ACTION_INFO[props.swipeRightAction].icon) +const rightIcon = computed(() => SWIPE_ACTION_INFO[props.swipeLeftAction].icon) +const leftIconColor = computed(() => SWIPE_ACTION_INFO[props.swipeRightAction].iconColor) +const rightIconColor= computed(() => SWIPE_ACTION_INFO[props.swipeLeftAction].iconColor) const confirmed = computed(() => Math.abs(swipeOffset.value) >= TRIGGER) function applyRubberBand(v: number): number { @@ -107,7 +109,7 @@ function onPointerMove(e: PointerEvent): void { if (!ptrDragging) { if (Math.abs(dx) < MIN_DRAG) return - if (Math.abs(dy) > Math.abs(dx)) return // vertical — not a swipe + if (Math.abs(dx) < Math.abs(dy) * H_RATIO) return // слишком диагональ — не свайп ptrDragging = true } @@ -238,7 +240,7 @@ onUnmounted(() => { class="action-bg action-left" :style="{ background: leftColor, opacity: progress }" > - + @@ -249,7 +251,7 @@ onUnmounted(() => { class="action-bg action-right" :style="{ background: rightColor, opacity: progress }" > - + @@ -326,8 +328,8 @@ onUnmounted(() => { display: flex; align-items: center; justify-content: center; - color: #fff; transition: transform 0.15s ease; + filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4)); } .action-icon.confirmed { transform: scale(1.3); } diff --git a/src/renderer/src/stores/settings.store.ts b/src/renderer/src/stores/settings.store.ts index 5fbd489..c17038c 100644 --- a/src/renderer/src/stores/settings.store.ts +++ b/src/renderer/src/stores/settings.store.ts @@ -10,11 +10,11 @@ export const SWIPE_ACTION_LABELS: Record = { none: 'Нет действия' } -export const SWIPE_ACTION_INFO: Record = { - delete: { icon: 'trash', color: 'var(--danger)' }, - toggleRead: { icon: 'envelope', color: 'var(--accent)' }, - toggleFlag: { icon: 'flag', color: 'var(--warning)' }, - none: { icon: '', color: 'transparent' } +export const SWIPE_ACTION_INFO: Record = { + delete: { icon: 'trash', color: 'rgba(200, 45, 45, 0.75)', iconColor: 'rgba(255,255,255,0.92)' }, + toggleRead: { icon: 'envelope', color: 'var(--accent-swipe-bg)', iconColor: 'var(--accent-text)' }, + toggleFlag: { icon: 'flag', color: 'rgba(200, 130, 0, 0.75)', iconColor: 'rgba(255,245,200,0.95)' }, + none: { icon: '', color: 'transparent', iconColor: '#fff' }, } // ─── Accent color ──────────────────────────────────────── @@ -51,12 +51,15 @@ function applyAccentColor(hex: string): void { const lum = getLuminance(r, g, b) const root = document.documentElement - root.style.setProperty('--accent', hex) - root.style.setProperty('--accent-hover', lightenHex(hex, 28)) - root.style.setProperty('--accent-muted', `rgba(${r},${g},${b},0.12)`) - root.style.setProperty('--accent-text', lum > 0.35 ? '#0d0d0d' : '#ffffff') - root.style.setProperty('--accent-glow', `rgba(${r},${g},${b},0.08)`) - root.style.setProperty('--bg-selected', `rgba(${r},${g},${b},0.10)`) + root.style.setProperty('--accent', hex) + root.style.setProperty('--accent-hover', lightenHex(hex, 28)) + root.style.setProperty('--accent-muted', `rgba(${r},${g},${b},0.12)`) + root.style.setProperty('--accent-text', lum > 0.35 ? '#0d0d0d' : '#ffffff') + root.style.setProperty('--accent-glow', `rgba(${r},${g},${b},0.08)`) + root.style.setProperty('--bg-selected', `rgba(${r},${g},${b},0.10)`) + // Фон свайп-действия: насыщенность зажата — никогда не бывает слепяще белым + const swipeAlpha = lum > 0.6 ? 0.45 : 0.72 + root.style.setProperty('--accent-swipe-bg', `rgba(${r},${g},${b},${swipeAlpha})`) } // ─── Storage ─────────────────────────────────────────────