Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

- name: Npm Install
run: npm install
- name: Npm Clean Install
run: npm ci

- name: Linux Test Setup
if: runner.os == 'Linux'
Expand Down
30 changes: 29 additions & 1 deletion core/block_svg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ export class BlockSvg
*/
width = 0;

/**
* Width of this block, not including any connected value blocks.
* Width is in workspace units.
*
* @internal
*/
childlessWidth = 0;

/**
* Map from IDs for warnings text to PIDs of functions to apply them.
* Used to be able to maintain multiple warnings.
Expand Down Expand Up @@ -436,8 +444,28 @@ export class BlockSvg
* @returns Object with coordinates of the bounding box.
*/
getBoundingRectangle(): Rect {
return this.getBoundingRectangleWithDimensions(this.getHeightWidth());
}

/**
* Returns the coordinates of a bounding box describing the dimensions of this
* block alone.
* Coordinate system: workspace coordinates.
*
* @returns Object with coordinates of the bounding box.
*/
getBoundingRectangleWithoutChildren(): Rect {
return this.getBoundingRectangleWithDimensions({
height: this.height,
width: this.width,
});
}

private getBoundingRectangleWithDimensions(blockBounds: {
height: number;
width: number;
}) {
const blockXY = this.getRelativeToSurfaceXY();
const blockBounds = this.getHeightWidth();
let left;
let right;
if (this.RTL) {
Expand Down
2 changes: 2 additions & 0 deletions core/blockly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ import {Marker} from './keyboard_nav/marker.js';
import {TabNavigateCursor} from './keyboard_nav/tab_navigate_cursor.js';
import {MarkerManager} from './marker_manager.js';
import type {LayerManager} from './layer_manager.js';
import * as layers from './layers.js';
import {Menu} from './menu.js';
import {MenuItem} from './menuitem.js';
import {MetricsManager} from './metrics_manager.js';
Expand Down Expand Up @@ -585,3 +586,4 @@ export {ZoomControls};
export {config};
export {inject};
export {serialization};
export {layers};
2 changes: 0 additions & 2 deletions core/layers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@
/**
* The layer to place blocks on.
*
* @internal
*/
export const BLOCK = 50;

/**
* The layer to place bubbles on.
*
* @internal
*/
export const BUBBLE = 100;
1 change: 1 addition & 0 deletions core/renderers/common/drawer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export class Drawer {
// The dark path adds to the size of the block in both X and Y.
this.block_.height = this.info_.height;
this.block_.width = this.info_.widthWithChildren;
this.block_.childlessWidth = this.info_.width;
}

/** Create the outline of the block. This is a single continuous path. */
Expand Down
48 changes: 24 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-jsdoc": "^48.0.2",
"glob": "^10.3.4",
"google-closure-compiler": "^20230802.0.0",
"google-closure-compiler": "^20240317.0.0",
"gulp": "^4.0.2",
"gulp-concat": "^2.6.1",
"gulp-gzip": "^1.4.2",
Expand All @@ -132,7 +132,7 @@
"markdown-tables-to-json": "^0.1.7",
"mocha": "^10.0.0",
"patch-package": "^8.0.0",
"prettier": "3.2.5",
"prettier": "3.3.2",
"readline-sync": "^1.4.10",
"rimraf": "^5.0.0",
"typescript": "^5.3.3",
Expand Down