A Blockly plugin that adds a zoom-to-fit control to the workspace.
npm install @blockly/zoom-to-fitA Blockly plugin that adds a
zoom-to-fit control to the workspace.
```
yarn add @blockly/zoom-to-fit
``
npm install @blockly/zoom-to-fit --save
`js
import * as Blockly from 'blockly';
import {ZoomToFitControl} from '@blockly/zoom-to-fit';
// Inject Blockly.
const workspace = Blockly.inject('blocklyDiv', {
toolbox: toolboxCategories,
});
// Initialize plugin.
const zoomToFit = new ZoomToFitControl(workspace);
zoomToFit.init();
`
- init: Initializes the zoom-to-fit control.dispose
- : Disposes of the zoom-to-fit control.getBoundingRectangle
- : Returns the bounding rectangle of the UI element inposition`: Positions the zoom-to-fit control.
pixel units relative to the Blockly injection div.
-
Apache 2.0