mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-07-09 06:21:57 +08:00
Tune pull and swipe gesture thresholds
This commit is contained in:
@@ -264,6 +264,15 @@ const {
|
|||||||
config: PULL_CONFIG,
|
config: PULL_CONFIG,
|
||||||
} = usePullDownGesture({
|
} = usePullDownGesture({
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
config: {
|
||||||
|
START_THRESHOLD: 28,
|
||||||
|
SHOW_INDICATOR: 80,
|
||||||
|
TRIGGER_THRESHOLD: 140,
|
||||||
|
MAX_PULL_DISTANCE: 220,
|
||||||
|
PULL_RESISTANCE: 0.7,
|
||||||
|
CONTENT_FOLLOW_RATIO: 0.35,
|
||||||
|
TOLERANCE: 96,
|
||||||
|
},
|
||||||
canUsePullGesture,
|
canUsePullGesture,
|
||||||
onTrigger: () => {
|
onTrigger: () => {
|
||||||
showPluginQuickAccess.value = true
|
showPluginQuickAccess.value = true
|
||||||
|
|||||||
@@ -51,10 +51,11 @@ const pluginBackgroundColors = ref<Record<string, string>>({})
|
|||||||
|
|
||||||
// 上滑关闭配置常量
|
// 上滑关闭配置常量
|
||||||
const SWIPE_CONFIG = {
|
const SWIPE_CONFIG = {
|
||||||
START_THRESHOLD: 10, // 开始检测上滑的最小距离
|
START_THRESHOLD: 16, // 开始检测上滑的最小距离
|
||||||
CLOSE_THRESHOLD: 100, // 触发关闭的距离
|
CLOSE_THRESHOLD: 144, // 触发关闭的距离
|
||||||
|
QUICK_CLOSE_MIN_DISTANCE: 56, // 快速关闭所需的最小位移
|
||||||
MAX_DRAG_DISTANCE: 1000, // 最大拖拽距离
|
MAX_DRAG_DISTANCE: 1000, // 最大拖拽距离
|
||||||
VELOCITY_THRESHOLD: 0.8, // 快速滑动速度阈值 (px/ms)
|
VELOCITY_THRESHOLD: 1.15, // 快速滑动速度阈值 (px/ms)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 上滑关闭相关状态
|
// 上滑关闭相关状态
|
||||||
@@ -367,7 +368,8 @@ function handleTouchEnd() {
|
|||||||
if (isDraggingToClose.value) {
|
if (isDraggingToClose.value) {
|
||||||
// 判断是否应该关闭:距离超过阈值或者快速上滑
|
// 判断是否应该关闭:距离超过阈值或者快速上滑
|
||||||
const shouldClose =
|
const shouldClose =
|
||||||
dragOffset.value >= SWIPE_CONFIG.CLOSE_THRESHOLD || velocity.value >= SWIPE_CONFIG.VELOCITY_THRESHOLD
|
dragOffset.value >= SWIPE_CONFIG.CLOSE_THRESHOLD ||
|
||||||
|
(dragOffset.value >= SWIPE_CONFIG.QUICK_CLOSE_MIN_DISTANCE && velocity.value >= SWIPE_CONFIG.VELOCITY_THRESHOLD)
|
||||||
|
|
||||||
if (shouldClose) {
|
if (shouldClose) {
|
||||||
emit('close')
|
emit('close')
|
||||||
|
|||||||
Reference in New Issue
Block a user