Skip to content

Commit

Permalink
chore: 支付宝小程使用框架自带的tap 事件 (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
zengyue authored Dec 26, 2024
1 parent c700298 commit 127630a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 3 additions & 6 deletions packages/f-my/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { Canvas } from '@antv/f-engine';
function convertTouches(touches) {
if (!touches) return touches;
touches.forEach((touch) => {
touch.pageX = 0;
touch.pageY = 0;
touch.clientX = touch.x;
touch.clientY = touch.y;
});
Expand Down Expand Up @@ -172,17 +170,16 @@ Component({
onRender: onCanvasRender,
// @ts-ignore
offscreenCanvas: my.createOffscreenCanvas(),
useNativeClickEvent: false,
// useNativeClickEvent: false,
isTouchEvent: (e) => e.type.startsWith('touch'),
isMouseEvent: (e) => e.type.startsWith('mouse'),
});
this.canvas = canvas;
this.canvasEl = canvas.getCanvasEl();
return canvas;
},
click() {
// 支付宝小程序的 tap 的 event 对象里没有点击的位置信息,拾取不到具体元素,所以关闭 useNativeClickEvent 用 g 里面的 click 实现
// dispatchEvent(this.canvasEl, e, 'touchstart');
click(e) {
dispatchEvent(this.canvasEl, e, 'click');
},
touchStart(e) {
dispatchEvent(this.canvasEl, e, 'touchstart');
Expand Down
2 changes: 0 additions & 2 deletions packages/f-wx/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { Canvas } from '@antv/f-engine';
function convertTouches(touches) {
if (!touches) return touches;
touches.forEach((touch) => {
touch.pageX = 0;
touch.pageY = 0;
touch.clientX = touch.x;
touch.clientY = touch.y;
});
Expand Down

0 comments on commit 127630a

Please sign in to comment.