diff --git a/common/changes/@visactor/vchart/fix-zoomable-outside_2025-01-09-07-35.json b/common/changes/@visactor/vchart/fix-zoomable-outside_2025-01-09-07-35.json new file mode 100644 index 0000000000..ddc54f5836 --- /dev/null +++ b/common/changes/@visactor/vchart/fix-zoomable-outside_2025-01-09-07-35.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vchart", + "comment": "fix: fix the issue where map drag interaction cannot be terminated outside the canvas, #3650", + "type": "none" + } + ], + "packageName": "@visactor/vchart" +} \ No newline at end of file diff --git a/packages/vchart/src/interaction/zoom/zoomable.ts b/packages/vchart/src/interaction/zoom/zoomable.ts index aef175bc5d..3fbee7985f 100644 --- a/packages/vchart/src/interaction/zoom/zoomable.ts +++ b/packages/vchart/src/interaction/zoom/zoomable.ts @@ -473,7 +473,10 @@ export class Zoomable implements IZoomable { } as unknown as BaseEventParams); this._zoomableTrigger.pointerId = null; this._eventObj.off(move, { level: Event_Bubble_Level.chart, source: Event_Source_Type.chart }, mousemove as any); - this._eventObj.off(end, { level: Event_Bubble_Level.chart, source: Event_Source_Type.window }, mouseup as any); + [end, `${end}outside`].forEach(type => { + this._eventObj.off(type, { level: Event_Bubble_Level.chart, source: Event_Source_Type.chart }, mouseup as any); + }); + this._eventObj.allow(end); }, delayTime); @@ -502,6 +505,8 @@ export class Zoomable implements IZoomable { }, delayTime); this._eventObj.on(move, { level: Event_Bubble_Level.chart, source: Event_Source_Type.chart }, mousemove as any); - this._eventObj.on(end, { level: Event_Bubble_Level.chart, source: Event_Source_Type.chart }, mouseup as any); + [end, `${end}outside`].forEach(type => { + this._eventObj.on(type, { level: Event_Bubble_Level.chart, source: Event_Source_Type.chart }, mouseup as any); + }); } }