Skip to content

Commit

Permalink
fix getEventContainerPoint error in mobile device (#2369)
Browse files Browse the repository at this point in the history
  • Loading branch information
deyihu authored Jul 3, 2024
1 parent 670c0f6 commit eeefedb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/core/util/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,16 @@ export function getEventContainerPoint(ev: MouseEvent, dom: HTMLElement) {
if (!domPos) {
domPos = computeDomPosition(dom);
}
//in mobile #1720
const toucheEvent = ev as unknown as TouchEvent;
//touchevent
if (toucheEvent.touches && toucheEvent.touches.length) {
ev = toucheEvent.touches[0] as unknown as MouseEvent;
}
//touchendevent
if (toucheEvent.changedTouches && toucheEvent.changedTouches.length) {
ev = toucheEvent.changedTouches[0] as unknown as MouseEvent;
}
// div by scaleX, scaleY to fix #450
return new Point(
(ev.clientX - domPos[0] - dom.clientLeft) / domPos[2],
Expand Down

0 comments on commit eeefedb

Please sign in to comment.