diff --git a/core/render_management.ts b/core/render_management.ts index 38c2ccc12..1139c2de8 100644 --- a/core/render_management.ts +++ b/core/render_management.ts @@ -86,6 +86,7 @@ function doRenders() { renderBlock(block); updateConnectionLocations(block, block.getRelativeToSurfaceXY()); + updateIconLocations(block); } for (const workspace of workspaces) { workspace.resizeContents(); @@ -129,3 +130,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); + } +}