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: non-nullable check for block variable and removed ! in layout_ #7522 #7537

Merged
merged 4 commits into from
Sep 24, 2023
Merged
Changes from 3 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
20 changes: 13 additions & 7 deletions core/flyout_horizontal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,29 +267,35 @@
for (let i = 0, item; (item = contents[i]); i++) {
if (item.type === 'block') {
const block = item.block;
const allBlocks = block!.getDescendants(false);

if (block === undefined || block === null) { {
johnnesky marked this conversation as resolved.
Show resolved Hide resolved
continue;
}

const allBlocks = block.getDescendants(false);

for (let j = 0, child; (child = allBlocks[j]); j++) {
// 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
// a block.
child.isInFlyout = true;
}
const root = block!.getSvgRoot();
const blockHW = block!.getHeightWidth();
const root = block.getSvgRoot();
const blockHW = block.getHeightWidth();
// Figure out where to place the block.
const tab = block!.outputConnection ? this.tabWidth_ : 0;
const tab = block.outputConnection ? this.tabWidth_ : 0;
let moveX;
if (this.RTL) {
moveX = cursorX + blockHW.width;
} else {
moveX = cursorX - tab;
}
block!.moveBy(moveX, cursorY);
block.moveBy(moveX, cursorY);

const rect = this.createRect_(block!, moveX, cursorY, blockHW, i);
const rect = this.createRect_(block, moveX, cursorY, blockHW, i);
cursorX += blockHW.width + gaps[i];

this.addBlockListeners_(root, block!, rect);
this.addBlockListeners_(root, block, rect);
} else if (item.type === 'button') {
const button = item.button as FlyoutButton;
this.initFlyoutButton_(button, cursorX, cursorY);
Expand All @@ -307,7 +313,7 @@
* at mouse down, in pixel units.
* @returns True if the drag is toward the workspace.
* @internal
*/

Check failure on line 316 in core/flyout_horizontal.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 16.x)

Unexpected keyword or identifier.

Check failure on line 316 in core/flyout_horizontal.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 16.x)

',' expected.

Check failure on line 316 in core/flyout_horizontal.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 16.x)

';' expected.

Check failure on line 316 in core/flyout_horizontal.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 16.x)

Unexpected keyword or identifier.

Check failure on line 316 in core/flyout_horizontal.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 20.x)

Unexpected keyword or identifier.

Check failure on line 316 in core/flyout_horizontal.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 20.x)

',' expected.

Check failure on line 316 in core/flyout_horizontal.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 20.x)

';' expected.

Check failure on line 316 in core/flyout_horizontal.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 20.x)

Unexpected keyword or identifier.
override isDragTowardWorkspace(currentDragDeltaXY: Coordinate): boolean {
const dx = currentDragDeltaXY.x;
const dy = currentDragDeltaXY.y;
Expand All @@ -331,7 +337,7 @@
*
* @returns The component's bounding box. Null if drag target area should be
* ignored.
*/

Check failure on line 340 in core/flyout_horizontal.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 16.x)

Unexpected keyword or identifier.

Check failure on line 340 in core/flyout_horizontal.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 16.x)

';' expected.

Check failure on line 340 in core/flyout_horizontal.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 16.x)

';' expected.

Check failure on line 340 in core/flyout_horizontal.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 20.x)

Unexpected keyword or identifier.

Check failure on line 340 in core/flyout_horizontal.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 20.x)

';' expected.

Check failure on line 340 in core/flyout_horizontal.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 20.x)

';' expected.
override getClientRect(): Rect | null {
if (!this.svgGroup_ || this.autoClose || !this.isVisible()) {
// The bounding rectangle won't compute correctly if the flyout is closed
Expand Down Expand Up @@ -359,7 +365,7 @@
/**
* Compute height of flyout. toolbox.Position mat under each block.
* For RTL: Lay out the blocks right-aligned.
*/

Check failure on line 368 in core/flyout_horizontal.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 16.x)

Declaration or statement expected.

Check failure on line 368 in core/flyout_horizontal.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 20.x)

Declaration or statement expected.
protected override reflowInternal_() {
this.workspace_.scale = this.getFlyoutScale();
let flyoutHeight = 0;
Expand Down
Loading