diff --git a/core/dragging/block_drag_strategy.ts b/core/dragging/block_drag_strategy.ts index dc136d814..2afdba51f 100644 --- a/core/dragging/block_drag_strategy.ts +++ b/core/dragging/block_drag_strategy.ts @@ -61,6 +61,9 @@ export class BlockDragStrategy implements IDragStrategy { */ private dragOffset = new Coordinate(0, 0); + /** Was there already an event group in progress when the drag started? */ + private inGroup: boolean = false; + constructor(private block: BlockSvg) { this.workspace = block.workspace; } @@ -92,7 +95,8 @@ export class BlockDragStrategy implements IDragStrategy { } this.dragging = true; - if (!eventUtils.getGroup()) { + this.inGroup = !!eventUtils.getGroup(); + if (!this.inGroup) { eventUtils.setGroup(true); } this.fireDragStartEvent(); @@ -389,7 +393,9 @@ export class BlockDragStrategy implements IDragStrategy { this.connectionPreviewer!.dispose(); this.workspace.setResizesEnabled(true); - eventUtils.setGroup(false); + if (!this.inGroup) { + eventUtils.setGroup(false); + } } /** Connects the given candidate connections. */ diff --git a/core/dragging/bubble_drag_strategy.ts b/core/dragging/bubble_drag_strategy.ts index 7ffccddc1..f388bb94c 100644 --- a/core/dragging/bubble_drag_strategy.ts +++ b/core/dragging/bubble_drag_strategy.ts @@ -13,6 +13,9 @@ import * as layers from '../layers.js'; export class BubbleDragStrategy implements IDragStrategy { private startLoc: Coordinate | null = null; + /** Was there already an event group in progress when the drag started? */ + private inGroup: boolean = false; + constructor( private bubble: IBubble, private workspace: WorkspaceSvg, @@ -23,7 +26,8 @@ export class BubbleDragStrategy implements IDragStrategy { } startDrag(): void { - if (!eventUtils.getGroup()) { + this.inGroup = !!eventUtils.getGroup(); + if (!this.inGroup) { eventUtils.setGroup(true); } this.startLoc = this.bubble.getRelativeToSurfaceXY(); @@ -38,7 +42,9 @@ export class BubbleDragStrategy implements IDragStrategy { endDrag(): void { this.workspace.setResizesEnabled(true); - eventUtils.setGroup(false); + if (!this.inGroup) { + eventUtils.setGroup(false); + } this.workspace .getLayerManager() diff --git a/core/dragging/comment_drag_strategy.ts b/core/dragging/comment_drag_strategy.ts index 2ad5fa144..2197d37f2 100644 --- a/core/dragging/comment_drag_strategy.ts +++ b/core/dragging/comment_drag_strategy.ts @@ -17,6 +17,9 @@ export class CommentDragStrategy implements IDragStrategy { private workspace: WorkspaceSvg; + /** Was there already an event group in progress when the drag started? */ + private inGroup: boolean = false; + constructor(private comment: RenderedWorkspaceComment) { this.workspace = comment.workspace; } @@ -26,7 +29,8 @@ export class CommentDragStrategy implements IDragStrategy { } startDrag(): void { - if (!eventUtils.getGroup()) { + this.inGroup = !!eventUtils.getGroup(); + if (!this.inGroup) { eventUtils.setGroup(true); } this.fireDragStartEvent(); @@ -52,7 +56,9 @@ export class CommentDragStrategy implements IDragStrategy { this.comment.snapToGrid(); this.workspace.setResizesEnabled(true); - eventUtils.setGroup(false); + if (!this.inGroup) { + eventUtils.setGroup(false); + } } /** Fire a UI event at the start of a comment drag. */