Skip to content

Commit

Permalink
refactor(behaviors): zoom canvas support disable preventDefault
Browse files Browse the repository at this point in the history
  • Loading branch information
antv committed Aug 20, 2024
1 parent 8e01142 commit 174209f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/g6/src/behaviors/zoom-canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ export interface ZoomCanvasOptions extends BaseBehaviorOptions {
* <en/> Callback when zooming is completed
*/
onFinish?: () => void;
/**
* <zh/> 是否阻止默认事件
*
* <en/> Whether to prevent the default event
* @defaultValue true
*/
preventDefault?: boolean;
}

/**
Expand All @@ -70,6 +77,7 @@ export class ZoomCanvas extends BaseBehavior<ZoomCanvasOptions> {
enable: true,
sensitivity: 1,
trigger: [],
preventDefault: true,
};

private shortcut: Shortcut;
Expand Down Expand Up @@ -171,7 +179,7 @@ export class ZoomCanvas extends BaseBehavior<ZoomCanvasOptions> {
}

private preventDefault = (event: Event) => {
event.preventDefault();
if (this.options.preventDefault) event.preventDefault();
};

/**
Expand Down

0 comments on commit 174209f

Please sign in to comment.