diff --git a/core/insertion_marker_manager.ts b/core/insertion_marker_manager.ts index 7f53caa0d29..54859e3d201 100644 --- a/core/insertion_marker_manager.ts +++ b/core/insertion_marker_manager.ts @@ -179,18 +179,18 @@ export class InsertionMarkerManager { */ applyConnections() { if (!this.activeCandidate) return; - const {local, closest} = this.activeCandidate; - local.connect(closest); eventUtils.disable(); this.hidePreview(); eventUtils.enable(); + const {local, closest} = this.activeCandidate; + local.connect(closest); if (this.topBlock.rendered) { const inferiorConnection = local.isSuperior() ? closest : local; - blockAnimations.connectionUiEffect(inferiorConnection.getSourceBlock()); const rootBlock = this.topBlock.getRootBlock(); // bringToFront is incredibly expensive. Delay by at least a frame. requestAnimationFrame(() => { + blockAnimations.connectionUiEffect(inferiorConnection.getSourceBlock()); setTimeout(() => { rootBlock.bringToFront(); }, 0); diff --git a/core/render_management.ts b/core/render_management.ts index 658f0b1d8fa..b931ab7e5c9 100644 --- a/core/render_management.ts +++ b/core/render_management.ts @@ -55,6 +55,7 @@ function doRenders() { renderBlock(block); updateConnectionLocations(block, block.getRelativeToSurfaceXY()); + updateIconLocations(block); } for (const workspace of workspaces) { workspace.resizeContents(); @@ -98,3 +99,19 @@ function updateConnectionLocations(block: BlockSvg, blockOrigin: Coordinate) { } } } + +/** + * Updates all icons that are children of the given block with their new + * locations. + * + * @param block The block to update the icon locations of. + */ +function updateIconLocations(block: BlockSvg) { + if (!block.getIcons) return; + for (const icon of block.getIcons()) { + icon.computeIconLocation(); + } + for (const child of block.getChildren(false)) { + updateIconLocations(child); + } +} diff --git a/package-lock.json b/package-lock.json index 518096d917f..0b7fcb5b4fe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "blockly", - "version": "9.3.2", + "version": "9.3.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "blockly", - "version": "9.3.2", + "version": "9.3.3", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { diff --git a/package.json b/package.json index 077724ae4bf..901b6caac65 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "blockly", - "version": "9.3.2", + "version": "9.3.3", "description": "Blockly is a library for building visual programming editors.", "keywords": [ "blockly"