mirror of
https://github.com/google/blockly.git
synced 2026-01-07 17:10:11 +01:00
fix: non-nullable check for block variable and removed ! in layout_ (#7536)
* Fix: 7523 - non-nullable check for block variable and removed ! * Fix: non nullable check for block variable * fix: fixed styling issue * fix: updated block variable nullable condition * Updated nullable condition for block variable
This commit is contained in:
@@ -233,29 +233,32 @@ export class VerticalFlyout extends Flyout {
|
|||||||
for (let i = 0, item; (item = contents[i]); i++) {
|
for (let i = 0, item; (item = contents[i]); i++) {
|
||||||
if (item.type === 'block') {
|
if (item.type === 'block') {
|
||||||
const block = item.block;
|
const block = item.block;
|
||||||
const allBlocks = block!.getDescendants(false);
|
if (!block) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const allBlocks = block.getDescendants(false);
|
||||||
for (let j = 0, child; (child = allBlocks[j]); j++) {
|
for (let j = 0, child; (child = allBlocks[j]); j++) {
|
||||||
// Mark blocks as being inside a flyout. This is used to detect and
|
// Mark blocks as being inside a flyout. This is used to detect and
|
||||||
// prevent the closure of the flyout if the user right-clicks on such
|
// prevent the closure of the flyout if the user right-clicks on such
|
||||||
// a block.
|
// a block.
|
||||||
child.isInFlyout = true;
|
child.isInFlyout = true;
|
||||||
}
|
}
|
||||||
const root = block!.getSvgRoot();
|
const root = block.getSvgRoot();
|
||||||
const blockHW = block!.getHeightWidth();
|
const blockHW = block.getHeightWidth();
|
||||||
const moveX = block!.outputConnection
|
const moveX = block.outputConnection
|
||||||
? cursorX - this.tabWidth_
|
? cursorX - this.tabWidth_
|
||||||
: cursorX;
|
: cursorX;
|
||||||
block!.moveBy(moveX, cursorY);
|
block.moveBy(moveX, cursorY);
|
||||||
|
|
||||||
const rect = this.createRect_(
|
const rect = this.createRect_(
|
||||||
block!,
|
block,
|
||||||
this.RTL ? moveX - blockHW.width : moveX,
|
this.RTL ? moveX - blockHW.width : moveX,
|
||||||
cursorY,
|
cursorY,
|
||||||
blockHW,
|
blockHW,
|
||||||
i,
|
i,
|
||||||
);
|
);
|
||||||
|
|
||||||
this.addBlockListeners_(root, block!, rect);
|
this.addBlockListeners_(root, block, rect);
|
||||||
|
|
||||||
cursorY += blockHW.height + gaps[i];
|
cursorY += blockHW.height + gaps[i];
|
||||||
} else if (item.type === 'button') {
|
} else if (item.type === 'button') {
|
||||||
|
|||||||
Reference in New Issue
Block a user