Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
18 changes: 11 additions & 7 deletions packages/vchart/src/component/geo/geo-coordinate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import type { BaseEventParams, ExtendEventParam, PanEventParam, ZoomEventParam }
import type { StringOrNumber } from '../../typings';
import type { IZoomable, ZoomEventParams } from '../../interaction/zoom/zoomable';
import { Zoomable } from '../../interaction/zoom/zoomable';
import { isValid, mixin, isNil, Matrix, isEqual } from '@visactor/vutils';
import { isValid, mixin, isNil, Matrix, isEqual, isBoolean } from '@visactor/vutils';
import type { Maybe } from '@visactor/vutils';
import { DEFAULT_MAP_LOOK_UP_KEY } from '../../data/transforms/map';
import { Factory } from '../../core/factory';
Expand Down Expand Up @@ -171,12 +171,16 @@ export class GeoCoordinate extends BaseComponent<IGeoRegionSpec> implements IGeo

const { roam } = this._spec;
if (roam) {
(this as unknown as IZoomable).initZoomEventOfRegions(this._regions, null, this._handleChartZoom);
(this as unknown as IZoomable).initDragEventOfRegions(
this._regions,
(roam as any).blank ? null : () => true,
this.pan
);
let zoom = true;
let drag = true;
let blank = false;
if (roam !== true) {
zoom = roam.zoom ?? true;
drag = roam.drag ?? true;
blank = roam.blank ?? false;
}
zoom && (this as unknown as IZoomable).initZoomEventOfRegions(this._regions, null, this._handleChartZoom);
drag && (this as unknown as IZoomable).initDragEventOfRegions(this._regions, blank ? null : () => true, this.pan);

this._regions.forEach(r => {
r.getSeries().forEach(s => {
Expand Down
4 changes: 3 additions & 1 deletion packages/vchart/src/region/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ export interface IGeoRegionSpec extends IRegionSpec {
* 是否可以拖拽
* @default false
* @since 1.12.8 支持 blank 配置,在 region 空白区域也能触发拖拽
* @since 2.0.5 支持 zoom 、drag 配置,单独开启 zoom 或 drag 功能
* roam为对象时,默认为 { zoom: true, drag: true, blank: false }
*/
roam?: boolean | { blank?: boolean };
roam?: boolean | { zoom?: boolean; drag?: boolean; blank?: boolean };
/**
* 数据中的经度字段名
*/
Expand Down
Loading