@aurigma/design-atoms
Version:
Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.
18 lines • 897 B
JavaScript
import { BaseCommand } from "./../../Commands/BaseCommand";
import { ArgumentException } from "@aurigma/design-atoms-model/Exception";
export class MoveViewportCommand extends BaseCommand {
constructor(args, _viewer) {
super(args);
this._viewer = _viewer;
}
async execute() {
var _a, _b, _c, _d;
if (((_a = this._args) === null || _a === void 0 ? void 0 : _a.delta) == null)
throw new ArgumentException(`MoveViewportCommand: delta cannot be null`);
if (((_b = this._viewer) === null || _b === void 0 ? void 0 : _b.element) == null)
return;
this._viewer.element.scrollLeft += (_c = this._args.delta.x) !== null && _c !== void 0 ? _c : 0;
this._viewer.element.scrollTop += (_d = this._args.delta.y) !== null && _d !== void 0 ? _d : 0;
}
}
//# sourceMappingURL=MoveViewportCommand.js.map