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

refactor: use getters for flyout width and height. #8564

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
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
10 changes: 5 additions & 5 deletions core/flyout_horizontal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export class HorizontalFlyout extends Flyout {
if (atTop) {
y = toolboxMetrics.height;
} else {
y = viewMetrics.height - this.height_;
y = viewMetrics.height - this.getHeight();
}
} else {
if (atTop) {
Expand All @@ -116,7 +116,7 @@ export class HorizontalFlyout extends Flyout {
// to align the bottom edge of the flyout with the bottom edge of the
// blocklyDiv, we calculate the full height of the div minus the height
// of the flyout.
y = viewMetrics.height + absoluteMetrics.top - this.height_;
y = viewMetrics.height + absoluteMetrics.top - this.getHeight();
}
}

Expand All @@ -133,13 +133,13 @@ export class HorizontalFlyout extends Flyout {
this.width_ = targetWorkspaceViewMetrics.width;

const edgeWidth = targetWorkspaceViewMetrics.width - 2 * this.CORNER_RADIUS;
const edgeHeight = this.height_ - this.CORNER_RADIUS;
const edgeHeight = this.getHeight() - this.CORNER_RADIUS;
this.setBackgroundPath(edgeWidth, edgeHeight);

const x = this.getX();
const y = this.getY();

this.positionAt_(this.width_, this.height_, x, y);
this.positionAt_(this.getWidth(), this.getHeight(), x, y);
}

/**
Expand Down Expand Up @@ -380,7 +380,7 @@ export class HorizontalFlyout extends Flyout {
flyoutHeight *= this.workspace_.scale;
flyoutHeight += Scrollbar.scrollbarThickness;

if (this.height_ !== flyoutHeight) {
if (this.getHeight() !== flyoutHeight) {
for (let i = 0, block; (block = blocks[i]); i++) {
if (this.rectMap_.has(block)) {
this.moveRectToBlock_(this.rectMap_.get(block)!, block);
Expand Down
10 changes: 5 additions & 5 deletions core/flyout_vertical.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class VerticalFlyout extends Flyout {
if (this.toolboxPosition_ === toolbox.Position.LEFT) {
x = toolboxMetrics.width;
} else {
x = viewMetrics.width - this.width_;
x = viewMetrics.width - this.getWidth();
}
} else {
if (this.toolboxPosition_ === toolbox.Position.LEFT) {
Expand All @@ -104,7 +104,7 @@ export class VerticalFlyout extends Flyout {
// to align the right edge of the flyout with the right edge of the
// blocklyDiv, we calculate the full width of the div minus the width
// of the flyout.
x = viewMetrics.width + absoluteMetrics.left - this.width_;
x = viewMetrics.width + absoluteMetrics.left - this.getWidth();
}
}

Expand All @@ -130,15 +130,15 @@ export class VerticalFlyout extends Flyout {
const targetWorkspaceViewMetrics = metricsManager.getViewMetrics();
this.height_ = targetWorkspaceViewMetrics.height;

const edgeWidth = this.width_ - this.CORNER_RADIUS;
const edgeWidth = this.getWidth() - this.CORNER_RADIUS;
const edgeHeight =
targetWorkspaceViewMetrics.height - 2 * this.CORNER_RADIUS;
this.setBackgroundPath(edgeWidth, edgeHeight);

const x = this.getX();
const y = this.getY();

this.positionAt_(this.width_, this.height_, x, y);
this.positionAt_(this.getWidth(), this.getHeight(), x, y);
}

/**
Expand Down Expand Up @@ -349,7 +349,7 @@ export class VerticalFlyout extends Flyout {
flyoutWidth *= this.workspace_.scale;
flyoutWidth += Scrollbar.scrollbarThickness;

if (this.width_ !== flyoutWidth) {
if (this.getWidth() !== flyoutWidth) {
for (let i = 0, block; (block = blocks[i]); i++) {
if (this.RTL) {
// With the flyoutWidth known, right-align the blocks.
Expand Down
Loading