fix: Always draw dragged blocks atop others in the workspace. (#6874)

* fix: Always draw dragged blocks atop others in the workspace.

* chore: format

---------

Co-authored-by: Beka Westberg <bwestberg@google.com>
This commit is contained in:
Aaron Dodson
2023-08-21 14:58:30 -07:00
committed by GitHub
parent a0301a217a
commit 9909868435
2 changed files with 16 additions and 9 deletions

View File

@@ -105,13 +105,10 @@ export class BlockDragger implements IBlockDragger {
}
this.fireDragStartEvent_();
// Mutators don't have the same type of z-ordering as the normal workspace
// during a drag. They have to rely on the order of the blocks in the SVG.
// For performance reasons that usually happens at the end of a drag,
// but do it at the beginning for mutators.
if (this.workspace_.isMutator) {
this.draggingBlock_.bringToFront();
}
// The z-order of blocks depends on their order in the SVG, so move the
// block being dragged to the front so that it will appear atop other blocks
// in the workspace.
this.draggingBlock_.bringToFront(true);
// During a drag there may be a lot of rerenders, but not field changes.
// Turn the cache on so we don't do spurious remeasures during the drag.