mirror of
https://github.com/google/blockly.git
synced 2026-01-04 15:40:08 +01:00
fix: Fix a bug where selection outlines could be cut off when connecting blocks. (#8789)
This commit is contained in:
@@ -533,6 +533,21 @@ export class RenderedConnection extends Connection {
|
||||
childBlock.updateDisabled();
|
||||
childBlock.queueRender();
|
||||
|
||||
// If either block being connected was selected, visually un- and reselect
|
||||
// it. This has the effect of moving the selection path to the end of the
|
||||
// list of child nodes in the DOM. Since SVG z-order is determined by node
|
||||
// order in the DOM, this works around an issue where the selection outline
|
||||
// path could be partially obscured by a new block inserted after it in the
|
||||
// DOM.
|
||||
const selection = common.getSelected();
|
||||
const selectedBlock =
|
||||
(selection === parentBlock && parentBlock) ||
|
||||
(selection === childBlock && childBlock);
|
||||
if (selectedBlock) {
|
||||
selectedBlock.removeSelect();
|
||||
selectedBlock.addSelect();
|
||||
}
|
||||
|
||||
// The input the child block is connected to (if any).
|
||||
const parentInput = parentBlock.getInputWithBlock(childBlock);
|
||||
if (parentInput) {
|
||||
|
||||
Reference in New Issue
Block a user