Skip to content

Commit ec6c1e2

Browse files
committed
fix: fix datazoom drag and zoom triggered at the same time, fix #3819
1 parent cc80a21 commit ec6c1e2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/vchart/src/interaction/zoom/zoomable.ts

+7
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ export class Zoomable implements IZoomable {
139139
) {
140140
return;
141141
}
142+
this._clearDragEvent(); // 防止drag 事件被同时触发,状态混乱
143+
this._zoomableTrigger.clearScroll(); // 防止scroll事件被同时触发,状态混乱
144+
142145
let extendParams: ReturnType<typeof callback> = {};
143146
if (callback) {
144147
extendParams = callback({ zoomDelta, zoomX, zoomY }, event);
@@ -259,6 +262,8 @@ export class Zoomable implements IZoomable {
259262
) {
260263
return stopBubble;
261264
}
265+
this._clearDragEvent(); // 防止drag 同时触发,状态混乱
266+
this._zoomableTrigger.clearZoom(); // 防止zoom同时触发,状态混乱
262267

263268
if (callback) {
264269
stopBubble = callback({ scrollX, scrollY }, event as any);
@@ -483,6 +488,8 @@ export class Zoomable implements IZoomable {
483488
if (!this._zoomableTrigger.parserDragEvent(params.event)) {
484489
return;
485490
}
491+
this._zoomableTrigger.clearZoom(); // 防止zoom 事件被同时触发, 状态混乱
492+
this._zoomableTrigger.clearScroll(); // 防止 scroll 事件被同时触发, 状态混乱
486493
const delayType = option?.delayType ?? 'throttle';
487494
const delayTime = option?.delayTime ?? 0;
488495
const realTime = option?.realTime ?? true;

0 commit comments

Comments
 (0)