@@ -55,24 +55,15 @@ export class BlockDragStrategy implements IDragStrategy {
5555
5656 private dragging = false ;
5757
58- /**
59- * If this is a shadow block, the offset between this block and the parent
60- * block, to add to the drag location. In workspace units.
61- */
62- private dragOffset = new Coordinate ( 0 , 0 ) ;
63-
6458 constructor ( private block : BlockSvg ) {
6559 this . workspace = block . workspace ;
6660 }
6761
6862 /** Returns true if the block is currently movable. False otherwise. */
6963 isMovable ( ) : boolean {
70- if ( this . block . isShadow ( ) ) {
71- return this . block . getParent ( ) ?. isMovable ( ) ?? false ;
72- }
73-
7464 return (
7565 this . block . isOwnMovable ( ) &&
66+ ! this . block . isShadow ( ) &&
7667 ! this . block . isDeadOrDying ( ) &&
7768 ! this . workspace . options . readOnly &&
7869 // We never drag blocks in the flyout, only create new blocks that are
@@ -86,11 +77,6 @@ export class BlockDragStrategy implements IDragStrategy {
8677 * from any parent blocks.
8778 */
8879 startDrag ( e ?: PointerEvent ) : void {
89- if ( this . block . isShadow ( ) ) {
90- this . startDraggingShadow ( e ) ;
91- return ;
92- }
93-
9480 this . dragging = true ;
9581 if ( ! eventUtils . getGroup ( ) ) {
9682 eventUtils . setGroup ( true ) ;
@@ -120,22 +106,6 @@ export class BlockDragStrategy implements IDragStrategy {
120106 this . workspace . getLayerManager ( ) ?. moveToDragLayer ( this . block ) ;
121107 }
122108
123- /** Starts a drag on a shadow, recording the drag offset. */
124- private startDraggingShadow ( e ?: PointerEvent ) {
125- const parent = this . block . getParent ( ) ;
126- if ( ! parent ) {
127- throw new Error (
128- 'Tried to drag a shadow block with no parent. ' +
129- 'Shadow blocks should always have parents.' ,
130- ) ;
131- }
132- this . dragOffset = Coordinate . difference (
133- parent . getRelativeToSurfaceXY ( ) ,
134- this . block . getRelativeToSurfaceXY ( ) ,
135- ) ;
136- parent . startDrag ( e ) ;
137- }
138-
139109 /**
140110 * Whether or not we should disconnect the block when a drag is started.
141111 *
@@ -204,11 +174,6 @@ export class BlockDragStrategy implements IDragStrategy {
204174
205175 /** Moves the block and updates any connection previews. */
206176 drag ( newLoc : Coordinate ) : void {
207- if ( this . block . isShadow ( ) ) {
208- this . block . getParent ( ) ?. drag ( Coordinate . sum ( newLoc , this . dragOffset ) ) ;
209- return ;
210- }
211-
212177 this . block . moveDuringDrag ( newLoc ) ;
213178 this . updateConnectionPreview (
214179 this . block ,
@@ -352,12 +317,7 @@ export class BlockDragStrategy implements IDragStrategy {
352317 * Cleans up any state at the end of the drag. Applies any pending
353318 * connections.
354319 */
355- endDrag ( e ?: PointerEvent ) : void {
356- if ( this . block . isShadow ( ) ) {
357- this . block . getParent ( ) ?. endDrag ( e ) ;
358- return ;
359- }
360-
320+ endDrag ( ) : void {
361321 this . fireDragEndEvent ( ) ;
362322 this . fireMoveEvent ( ) ;
363323
@@ -413,11 +373,6 @@ export class BlockDragStrategy implements IDragStrategy {
413373 * including reconnecting connections.
414374 */
415375 revertDrag ( ) : void {
416- if ( this . block . isShadow ( ) ) {
417- this . block . getParent ( ) ?. revertDrag ( ) ;
418- return ;
419- }
420-
421376 this . startChildConn ?. connect ( this . block . nextConnection ) ;
422377 if ( this . startParentConn ) {
423378 switch ( this . startParentConn . type ) {
0 commit comments