TaR1z commented on issue #9239:
URL: https://github.com/apache/echarts/issues/9239#issuecomment-2401182660
如果在微信小程序,可以劫持touchMove事件,设置四周边界,但是不完美,强行移动也会导致无法拖回
`javascript
touchMove(e) {
const chart = this.chart;
const needGesture = this.data.needGesture;
const len = e.touches.length;
const width = this.chart.getWidth();
const height = this.chart.getHeight();
const boundary = {
top: 0,
left: 0,
right: width,
bottom: height,
};
if (chart && len > 0) {
const touch = e.touches[0];
const handler = chart.getZr().handler;
const { x, y } = touch;
if (boundary.top > x || boundary.bottom < x || boundary.right < y ||
boundary.left > y) {
return;
}
if (needGesture && len === TOUCH_POINT_NUM) {
handler.processGesture(wrapTouch(e), 'change');
return;
}
handler.dispatch('mousemove', {
zrX: touch.x,
zrY: touch.y,
preventDefault: () => {},
stopImmediatePropagation: () => {},
stopPropagation: () => {},
});
}
},
`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]