@@ -62,8 +62,8 @@ export class BlockDragStrategy implements IDragStrategy {
6262 */
6363 private dragOffset = new Coordinate ( 0 , 0 ) ;
6464
65- /** Was there already an event group in progress when the drag started? */
66- private inGroup : boolean = false ;
65+ /** Used to persist an event group when snapping is done async. */
66+ private originalEventGroup = '' ;
6767
6868 constructor ( private block : BlockSvg ) {
6969 this . workspace = block . workspace ;
@@ -96,10 +96,6 @@ export class BlockDragStrategy implements IDragStrategy {
9696 }
9797
9898 this . dragging = true ;
99- this . inGroup = ! ! eventUtils . getGroup ( ) ;
100- if ( ! this . inGroup ) {
101- eventUtils . setGroup ( true ) ;
102- }
10399 this . fireDragStartEvent ( ) ;
104100
105101 this . startLoc = this . block . getRelativeToSurfaceXY ( ) ;
@@ -363,6 +359,7 @@ export class BlockDragStrategy implements IDragStrategy {
363359 this . block . getParent ( ) ?. endDrag ( e ) ;
364360 return ;
365361 }
362+ this . originalEventGroup = eventUtils . getGroup ( ) ;
366363
367364 this . fireDragEndEvent ( ) ;
368365 this . fireMoveEvent ( ) ;
@@ -388,20 +385,19 @@ export class BlockDragStrategy implements IDragStrategy {
388385 } else {
389386 this . block . queueRender ( ) . then ( ( ) => this . disposeStep ( ) ) ;
390387 }
391-
392- if ( ! this . inGroup ) {
393- eventUtils . setGroup ( false ) ;
394- }
395388 }
396389
397390 /** Disposes of any state at the end of the drag. */
398391 private disposeStep ( ) {
392+ const newGroup = eventUtils . getGroup ( ) ;
393+ eventUtils . setGroup ( this . originalEventGroup ) ;
399394 this . block . snapToGrid ( ) ;
400395
401396 // Must dispose after connections are applied to not break the dynamic
402397 // connections plugin. See #7859
403398 this . connectionPreviewer ! . dispose ( ) ;
404399 this . workspace . setResizesEnabled ( true ) ;
400+ eventUtils . setGroup ( newGroup ) ;
405401 }
406402
407403 /** Connects the given candidate connections. */
0 commit comments