@aurigma/design-atoms
Version:
Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.
31 lines • 1.18 kB
JavaScript
;
import { BaseCommand } from "../BaseCommand";
import { SelectionCommand } from "@aurigma/design-atoms-interfaces";
export class SelectAllItemsCommand extends BaseCommand {
constructor(_viewer, _cm) {
super();
this._viewer = _viewer;
this._cm = _cm;
}
execute() {
if (this._viewer == null)
return;
const selectedItem = this._viewer.selectedItems[0];
if (selectedItem != null && selectedItem.parentGroupItem != null) {
const groupItems = this._filterItems(selectedItem.parentGroupItem.items);
return this._cm.execute(SelectionCommand.selectItems, { items: groupItems });
}
else {
const items = this._filterItems(this._viewer.userEditContainer.items);
return this._cm.execute(SelectionCommand.selectItems, { items });
}
}
_filterItems(items) {
return items.toArray().filter((item) => {
const itemHandler = this._viewer.getHandler(item);
return itemHandler.isVisible() && !itemHandler.isLocked();
});
;
}
}
//# sourceMappingURL=SelectAllCommand.js.map