@blockly/zoom-to-fit
TypeScript icon, indicating that this package has built-in type declarations

5.0.16 • Public • Published

@blockly/zoom-to-fit Built on Blockly

A Blockly plugin that adds a zoom-to-fit control to the workspace.

Installation

Yarn

yarn add @blockly/zoom-to-fit

npm

npm install @blockly/zoom-to-fit --save

Usage

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();

API

  • init: Initializes the zoom-to-fit control.
  • dispose: Disposes of the zoom-to-fit control.
  • getBoundingRectangle: Returns the bounding rectangle of the UI element in pixel units relative to the Blockly injection div.
  • position: Positions the zoom-to-fit control.

License

Apache 2.0

Dependents (2)

Package Sidebar

Install

npm i @blockly/zoom-to-fit

Weekly Downloads

793

Version

5.0.16

License

Apache-2.0

Unpacked Size

46.9 kB

Total Files

10

Last publish

Collaborators

  • google-wombot
  • samelhusseini