UNPKG

@aurigma/design-atoms

Version:

Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.

27 lines 990 B
import { BaseCommand } from "../BaseCommand"; import { RectangleF } from "@aurigma/design-atoms-model/Math"; export class ZoomToItemsCommand extends BaseCommand { constructor(_productHandler, args, _canvas) { super(args); this._productHandler = _productHandler; this._canvas = _canvas; } async execute() { const viewer = this._canvas.viewer; const items = this._getTargetItems(this._args.items, this._args.query, this._args.queryOptions); const rect = RectangleF.getOverallBounds(items.map(i => viewer.getHandler(i).bounds)); viewer.zoomToRectangle(rect); } _getTargetItems(items, query, queryOptions) { if (items != null) { return items; } else if (query != null) { return this._productHandler.queryItems(query, queryOptions); } else { return []; } } } //# sourceMappingURL=ZoomToItemsCommand.js.map