Skip to main content

Home > 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

ParameterTypeDescription
idstring | nullID of block center on.
blockOnlyboolean(Optional) True to center only on the block itself, not its stack.

Returns:

void