Skip to content

Commit dcd2d0e

Browse files
authored
fix: Fix a bug where selection outlines could be cut off when connecting blocks. (#8789)
1 parent d016801 commit dcd2d0e

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

core/rendered_connection.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,21 @@ export class RenderedConnection extends Connection {
533533
childBlock.updateDisabled();
534534
childBlock.queueRender();
535535

536+
// If either block being connected was selected, visually un- and reselect
537+
// it. This has the effect of moving the selection path to the end of the
538+
// list of child nodes in the DOM. Since SVG z-order is determined by node
539+
// order in the DOM, this works around an issue where the selection outline
540+
// path could be partially obscured by a new block inserted after it in the
541+
// DOM.
542+
const selection = common.getSelected();
543+
const selectedBlock =
544+
(selection === parentBlock && parentBlock) ||
545+
(selection === childBlock && childBlock);
546+
if (selectedBlock) {
547+
selectedBlock.removeSelect();
548+
selectedBlock.addSelect();
549+
}
550+
536551
// The input the child block is connected to (if any).
537552
const parentInput = parentBlock.getInputWithBlock(childBlock);
538553
if (parentInput) {

0 commit comments

Comments
 (0)