Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: icons not having their locations updated #7012

Merged
merged 2 commits into from
Apr 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions core/render_management.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ function doRenders() {

renderBlock(block);
updateConnectionLocations(block, block.getRelativeToSurfaceXY());
updateIconLocations(block);
}
for (const workspace of workspaces) {
workspace.resizeContents();
Expand Down Expand Up @@ -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);
}
}