Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix the issue where map drag interaction cannot be terminated ou… #3658

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@visactor/vchart",
"comment": "fix: fix the issue where map drag interaction cannot be terminated outside the canvas.",
"type": "none"
}
],
"packageName": "@visactor/vchart"
}
9 changes: 7 additions & 2 deletions packages/vchart/src/interaction/zoom/zoomable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xiaoluoHe 是不是应该修改配置,将end 事件设置成 ['pointerup', 'pointerupoutside'] 更好,这里写的很死

packages/vchart/src/component/common/trigger/config.ts

this._eventObj.off(type, { level: Event_Bubble_Level.chart, source: Event_Source_Type.chart }, mouseup as any);
});

this._eventObj.allow(end);
}, delayTime);

Expand Down Expand Up @@ -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);
});
}
}
7 changes: 6 additions & 1 deletion packages/vchart/src/region/region.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { MarkTypeEnum } from '../mark/interface/type';
import type { ISeries } from '../series/interface';
import type { IModelOption } from '../model/interface';
import type { CoordinateType } from '../typings/coordinate';
import type { IRegion, IRegionSpec, IRegionSpecInfo } from './interface';
import type { IGeoRegionSpec, IRegion, IRegionSpec, IRegionSpecInfo } from './interface';
import type { IInteraction, ITrigger } from '../interaction/interface';
import { Interaction } from '../interaction/interaction';
import { ChartEvent } from '../constant/event';
Expand Down Expand Up @@ -167,6 +167,11 @@ export class Region<T extends IRegionSpec = IRegionSpec> extends LayoutModel<T>
'normal',
AttributeLevel.User_Mark
);

if ((this._spec as IGeoRegionSpec).roam) {
groupMark.setMarkConfig({ interactive: true });
}

this._marks.addMark(groupMark);
return groupMark;
}
Expand Down
Loading