blockly > WorkspaceSvg > centerOnBlock

WorkspaceSvg.centerOnBlock() method

Scroll the workspace to center on the given block. If the block has other blocks stacked below it, the workspace will be centered on the stack, unless blockOnly is true.

Signature:

centerOnBlock(id: string | null, blockOnly?: boolean): void;

Parameters

Parameter Type Description
id string | null ID of block center on.
blockOnly boolean (Optional) True to center only on the block itself, not its stack.

Returns:

void