fix: icons not having their locations updated (#7012)

* fix: icons not having their locations updated

* chore: fix running headful tests in node
This commit is contained in:
Beka Westberg
2023-04-24 15:36:13 -07:00
committed by GitHub
parent 60a2358cd7
commit 139bc299a0

View File

@@ -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);
}
}