Skip to content

Commit 961a83f

Browse files
committed
fix: icons not having their locations updated (google#7012)
* fix: icons not having their locations updated * chore: fix running headful tests in node (cherry picked from commit 139bc29)
1 parent ec6e951 commit 961a83f

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

core/render_management.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ function doRenders() {
5555

5656
renderBlock(block);
5757
updateConnectionLocations(block, block.getRelativeToSurfaceXY());
58+
updateIconLocations(block);
5859
}
5960
for (const workspace of workspaces) {
6061
workspace.resizeContents();
@@ -98,3 +99,19 @@ function updateConnectionLocations(block: BlockSvg, blockOrigin: Coordinate) {
9899
}
99100
}
100101
}
102+
103+
/**
104+
* Updates all icons that are children of the given block with their new
105+
* locations.
106+
*
107+
* @param block The block to update the icon locations of.
108+
*/
109+
function updateIconLocations(block: BlockSvg) {
110+
if (!block.getIcons) return;
111+
for (const icon of block.getIcons()) {
112+
icon.computeIconLocation();
113+
}
114+
for (const child of block.getChildren(false)) {
115+
updateIconLocations(child);
116+
}
117+
}

0 commit comments

Comments
 (0)