UNPKG

@blockly/zoom-to-fit

Version:
94 lines 2.51 kB
/** * @license * Copyright 2021 Google LLC * SPDX-License-Identifier: Apache-2.0 */ import * as Blockly from 'blockly/core'; /** * Class for zoom to fit control. */ export declare class ZoomToFitControl implements Blockly.IPositionable { protected workspace: Blockly.WorkspaceSvg; /** * The unique id for this component. */ id: string; /** * The SVG group containing the zoom-to-fit control. */ private svgGroup; /** * Left coordinate of the zoom-to-fit control. */ private left; /** * Top coordinate of the zoom-to-fit control. */ private top; /** * Width of the zoom-to-fit control. */ private readonly width; /** * Height of the zoom-to-fit control. */ private readonly height; /** * Distance between zoom-to-fit control and bottom or top edge of workspace. */ private readonly marginVertical; /** * Distance between zoom-to-fit control and right or left edge of workspace. */ private readonly marginHorizontal; /** * Whether this has been initialized. */ private initialized; private onZoomToFitWrapper; /** * Constructor for zoom-to-fit control. * * @param workspace The workspace that the zoom-to-fit * control will be added to. */ constructor(workspace: Blockly.WorkspaceSvg); /** * Initializes the zoom reset control. */ init(): void; /** * Disposes of workspace search. * Unlink from all DOM elements and remove all event listeners * to prevent memory leaks. */ dispose(): void; /** * Creates DOM for ui element. */ private createDom; /** * Handle click event. * * @param e A pointer down event. */ private onClick; /** * Returns the bounding rectangle of the UI element in pixel units relative to * the Blockly injection div. * * @returns The component’s bounding box. */ getBoundingRectangle(): Blockly.utils.Rect; /** * Positions the zoom-to-fit control. * It is positioned in the opposite corner to the corner the * categories/toolbox starts at. * * @param metrics The workspace metrics. * @param savedPositions List of rectangles that * are already on the workspace. */ position(metrics: Blockly.MetricsManager.UiMetrics, savedPositions: Blockly.utils.Rect[]): void; } //# sourceMappingURL=index.d.ts.map