blockly > WorkspaceSvg > zoom
WorkspaceSvg.zoom() method
Zooms the workspace in or out relative to/centered on the given (x, y) coordinate.
Signature:
zoom(x: number, y: number, amount: number): void;
Parameters
| Parameter | Type | Description |
|---|---|---|
| x | number | X coordinate of center, in pixel units relative to the top-left corner of the parentSVG. |
| y | number | Y coordinate of center, in pixel units relative to the top-left corner of the parentSVG. |
| amount | number | Amount of zooming. The formula for the new scale is newScale = currentScale * (scaleSpeed^amount). scaleSpeed is set in the workspace options. Negative amount values zoom out, and positive amount values zoom in. |
Returns:
void