mirror of
https://github.com/google/blockly.git
synced 2026-01-08 01:20:12 +01:00
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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user