From 21d0e9d3a7e3623d71e6e1965087cd47a82e5c49 Mon Sep 17 00:00:00 2001 From: Neko Date: Thu, 10 Sep 2026 16:11:09 +0800 Subject: [PATCH] fix(stage-ui): use touch events for mobile swipe (#2508) --- .../src/components/gestures/swipeable.ts | 6 +- .../src/components/gestures/swipeable.vue | 64 ++++----- .../chat/components/history-message-frame.vue | 2 +- .../chat/components/history.browser.test.ts | 123 +++++++++++++----- 4 files changed, 120 insertions(+), 75 deletions(-) diff --git a/packages/stage-ui/src/components/gestures/swipeable.ts b/packages/stage-ui/src/components/gestures/swipeable.ts index baf80f227..d333d3191 100644 --- a/packages/stage-ui/src/components/gestures/swipeable.ts +++ b/packages/stage-ui/src/components/gestures/swipeable.ts @@ -1,5 +1,5 @@ /** Input source that can drive Swipeable. */ -export type SwipeableInput = 'pointer' | 'wheel' +export type SwipeableInput = 'touch' | 'wheel' /** Horizontal direction that selects the action. */ export type SwipeableDirection = 'left' | 'right' @@ -8,11 +8,11 @@ export type SwipeableDirection = 'left' | 'right' export interface SwipeableProps { /** Enables gesture recognition. @default true */ enabled?: boolean - /** Selects touch/pointer dragging or desktop horizontal-wheel input. @default 'pointer' */ + /** Selects touch dragging or desktop horizontal-wheel input. @default 'touch' */ input?: SwipeableInput /** Selects the horizontal direction that commits the action. @default 'left' */ direction?: SwipeableDirection - /** Ignores pointer or wheel jitter below this distance, in pixels. @default 8 */ + /** Ignores touch or wheel jitter below this distance, in pixels. @default 8 */ startDistance?: number /** Commits the action when the directed distance reaches this value, in pixels. @default 48 */ threshold?: number diff --git a/packages/stage-ui/src/components/gestures/swipeable.vue b/packages/stage-ui/src/components/gestures/swipeable.vue index 7b0fdf389..eda7499ee 100644 --- a/packages/stage-ui/src/components/gestures/swipeable.vue +++ b/packages/stage-ui/src/components/gestures/swipeable.vue @@ -1,7 +1,7 @@