mirror of
https://github.com/google/blockly.git
synced 2026-01-08 09:30:06 +01:00
Auto-fix formatting issues to address CI failure.
This commit is contained in:
@@ -77,10 +77,12 @@ export class Rect {
|
||||
// the border's line segment is contained within the other rectangle. The simplified version
|
||||
// used here can be logically interpreted as ensuring that each line segment of 'this' rectangle
|
||||
// is not outside the bounds of the 'other' rectangle (proving there's an intersection).
|
||||
return (this.left <= other.right)
|
||||
&& (this.right >= other.left)
|
||||
&& (this.bottom >= other.top)
|
||||
&& (this.top <= other.bottom);
|
||||
return (
|
||||
this.left <= other.right &&
|
||||
this.right >= other.left &&
|
||||
this.bottom >= other.top &&
|
||||
this.top <= other.bottom
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,7 +99,12 @@ export class Rect {
|
||||
if (!a || !b) {
|
||||
return false;
|
||||
}
|
||||
return a.top === b.top && a.bottom === b.bottom && a.left === b.left && a.right === b.right;
|
||||
return (
|
||||
a.top === b.top &&
|
||||
a.bottom === b.bottom &&
|
||||
a.left === b.left &&
|
||||
a.right === b.right
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -108,7 +115,11 @@ export class Rect {
|
||||
* @param height The height of the rectangle, in pixels.
|
||||
* @returns A newly created Rect using the provided Coordinate and dimensions.
|
||||
*/
|
||||
static createFromPoint(position: Coordinate, width: number, height: number): Rect {
|
||||
static createFromPoint(
|
||||
position: Coordinate,
|
||||
width: number,
|
||||
height: number,
|
||||
): Rect {
|
||||
const left = position.x;
|
||||
const top = position.y;
|
||||
return new Rect(top, top + height, left, left + width);
|
||||
|
||||
@@ -1656,9 +1656,13 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg {
|
||||
const movableBlocks = topBlocks.filter((block) => block.isMovable());
|
||||
const immovableBlocks = topBlocks.filter((block) => !block.isMovable());
|
||||
|
||||
const immovableBlockBounds = immovableBlocks.map((block) => block.getBoundingRectangle());
|
||||
const immovableBlockBounds = immovableBlocks.map((block) =>
|
||||
block.getBoundingRectangle(),
|
||||
);
|
||||
|
||||
const getNextIntersectingImmovableBlock = function(rect: Rect): Rect|null {
|
||||
const getNextIntersectingImmovableBlock = function (
|
||||
rect: Rect,
|
||||
): Rect | null {
|
||||
for (const immovableRect of immovableBlockBounds) {
|
||||
if (rect.intersects(immovableRect)) {
|
||||
return immovableRect;
|
||||
@@ -1679,7 +1683,8 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg {
|
||||
let conflictingRect = getNextIntersectingImmovableBlock(boundingRect);
|
||||
while (conflictingRect != null) {
|
||||
// If the block intersects with an immovable block, move it down past that immovable block.
|
||||
cursorY = conflictingRect.top + conflictingRect.getHeight() + minBlockHeight;
|
||||
cursorY =
|
||||
conflictingRect.top + conflictingRect.getHeight() + minBlockHeight;
|
||||
block.moveBy(0, cursorY - boundingRect.top, ['cleanup']);
|
||||
block.snapToGrid();
|
||||
boundingRect = block.getBoundingRectangle();
|
||||
@@ -1688,7 +1693,10 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg {
|
||||
|
||||
// Ensure all next blocks start past the most recent (which will also put them past all
|
||||
// previously intersecting immovable blocks).
|
||||
cursorY = block.getRelativeToSurfaceXY().y + block.getHeightWidth().height + minBlockHeight;
|
||||
cursorY =
|
||||
block.getRelativeToSurfaceXY().y +
|
||||
block.getHeightWidth().height +
|
||||
minBlockHeight;
|
||||
}
|
||||
eventUtils.setGroup(false);
|
||||
this.setResizesEnabled(true);
|
||||
|
||||
Reference in New Issue
Block a user