mirror of
https://github.com/google/blockly.git
synced 2026-01-10 18:37:09 +01:00
chore: make getters for grid attributes public and update inline docs (#7865)
This commit is contained in:
27
core/grid.ts
27
core/grid.ts
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user