fix(behaviors): fix issue that cannot drag canvas when animation is enabled (#5514)

This commit is contained in:
Aaron 2024-03-11 18:30:51 +08:00 committed by GitHub
parent acd154f22d
commit 0b09106868
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -11,9 +11,9 @@ import { BaseBehavior } from './base-behavior';
export interface DragCanvasOptions extends BaseBehaviorOptions {
/**
* <zh/> 使
* <zh/> 使
*
* <en/> Whether to enable the animation of zooming, only valid when using key movement
* <en/> Whether to enable the animation of dragging, only valid when using key movement
*/
animation?: ViewportAnimationEffectTiming;
/**
@ -89,7 +89,7 @@ export class DragCanvas extends BaseBehavior<DragCanvasOptions> {
private onDrag = (event: BehaviorEvent<FederatedMouseEvent>) => {
if (event.targetType === 'canvas') {
this.context.graph.translateBy([event.movement.x, event.movement.y], this.options.animation);
this.context.graph.translateBy([event.movement.x, event.movement.y], false);
}
};