@@ -154,6 +154,8 @@ export class Mover {
154154 this . unpatchWorkspace ( workspace ) ;
155155 this . unpatchDragStrategy ( info . block ) ;
156156 this . moves . delete ( workspace ) ;
157+ // Delay scroll until after block has finished moving.
158+ setTimeout ( ( ) => this . scrollCurrentBlockIntoView ( workspace ) , 0 )
157159 return true ;
158160 }
159161
@@ -188,6 +190,8 @@ export class Mover {
188190 this . unpatchWorkspace ( workspace ) ;
189191 this . unpatchDragStrategy ( info . block ) ;
190192 this . moves . delete ( workspace ) ;
193+ // Delay scroll until after block has finished moving.
194+ setTimeout ( ( ) => this . scrollCurrentBlockIntoView ( workspace ) , 0 )
191195 return true ;
192196 }
193197
@@ -210,6 +214,7 @@ export class Mover {
210214 ) ;
211215
212216 info . updateTotalDelta ( ) ;
217+ this . scrollCurrentBlockIntoView ( workspace ) ;
213218 return true ;
214219 }
215220
@@ -231,6 +236,7 @@ export class Mover {
231236 info . totalDelta . y += y * UNCONSTRAINED_MOVE_DISTANCE * workspace . scale ;
232237
233238 info . dragger . onDrag ( info . fakePointerEvent ( 'pointermove' ) , info . totalDelta ) ;
239+ this . scrollCurrentBlockIntoView ( workspace ) ;
234240 return true ;
235241 }
236242
@@ -356,6 +362,20 @@ export class Mover {
356362 this . currentMoveIndicator ?. remove ( ) ;
357363 this . currentMoveIndicator = null ;
358364 }
365+
366+ /**
367+ * Scrolls the current block into view if exists one.
368+ *
369+ * @param workspace The workspace to get current block from.
370+ */
371+ private scrollCurrentBlockIntoView ( workspace : WorkspaceSvg ) {
372+ const blockToView = this . getCurrentBlock ( workspace ) ;
373+ if ( blockToView ) {
374+ workspace . scrollBoundsIntoView (
375+ blockToView . getBoundingRectangleWithoutChildren ( ) ,
376+ ) ;
377+ }
378+ }
359379}
360380
361381/**
0 commit comments