Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修复移动端禁用外部容器滚动不生效 #3097

Merged
merged 1 commit into from
Feb 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/s2-core/src/facet/base-facet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
FederatedWheelEvent,
Group,
Rect,
type FederatedPointerEvent as GraphEvent,
type FederatedPointerEvent,
} from '@antv/g';
import { interpolateArray } from 'd3-interpolate';
import { timer, type Timer } from 'd3-timer';
Expand Down Expand Up @@ -1445,8 +1445,9 @@ export abstract class BaseFacet {
event?.preventDefault?.();
}

// 移动端的 prevent 存在于 originalEvent 上
const mobileEvent = (event as unknown as GraphEvent)?.originalEvent;
// 使用 G 对应的原生 TouchEvent,以达到移动端禁用外部容器滚动的效果
const mobileEvent =
(event as unknown as FederatedPointerEvent)?.nativeEvent || event;

if (mobileEvent?.cancelable) {
mobileEvent?.preventDefault?.();
Expand Down
Loading