@aurigma/design-atoms
Version:
Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.
19 lines • 961 B
JavaScript
import { BaseCommand } from "../BaseCommand";
import { ArgumentException } from "@aurigma/design-atoms-model/Exception";
import { PrintAreaBoundsType } from "@aurigma/design-atoms-model/Product/PrintAreaBoundsType";
export class ZoomToSafetyLineCommand extends BaseCommand {
constructor(args, _canvas) {
super(args);
this._canvas = _canvas;
}
async execute() {
const viewer = this._canvas.viewer;
const safetyLine = this._args.safetyLine;
const targetPrintArea = viewer.surface.printAreas.toArray().find(pa => pa.safetyLines.contains(safetyLine));
if (targetPrintArea == null)
throw new ArgumentException(`Safety line '${safetyLine.name}' doesn't exist in current surface`);
const rect = safetyLine.getRectangle(targetPrintArea.getBounds(PrintAreaBoundsType.Trim));
viewer.zoomToRectangle(rect);
}
}
//# sourceMappingURL=ZoomToSafetyLineCommand.js.map