chore: make getters for grid attributes public and update inline docs (#7865)

This commit is contained in:
Beka Westberg
2024-03-08 17:16:18 +00:00
committed by GitHub
parent 848415e48f
commit 8dee571469

View File

@@ -66,12 +66,26 @@ export class Grid {
this.update(this.scale);
}
/**
* Get the spacing of the grid points (in px).
*
* @returns The spacing of the grid points.
*/
getSpacing(): number {
return this.spacing;
}
/** Sets the length of the grid lines. */
setLength(length: number) {
this.length = length;
this.update(this.scale);
}
/** Get the length of the grid lines (in px). */
getLength(): number {
return this.length;
}
/**
* Sets whether blocks should snap to the grid or not.
*
@@ -85,25 +99,14 @@ export class Grid {
}
/**
* Whether blocks should snap to the grid, based on the initial configuration.
* Whether blocks should snap to the grid.
*
* @returns True if blocks should snap, false otherwise.
* @internal
*/
shouldSnap(): boolean {
return this.snapToGrid;
}
/**
* Get the spacing of the grid points (in px).
*
* @returns The spacing of the grid points.
* @internal
*/
getSpacing(): number {
return this.spacing;
}
/**
* Get the ID of the pattern element, which should be randomized to avoid
* conflicts with other Blockly instances on the page.