UNPKG

@wcardinal/wcardinal-geditor

Version:

WebGL-based graphic editor, tester and viewer for supervisory systems

77 lines 2.81 kB
import { __extends } from "tslib"; import { DCommandBase } from "@wcardinal/wcardinal-ui"; import { EToolSelectSelectionUpdatedPart } from "../tool/e-tool-select-selection-updated-part"; var ECommandShapeTreeBringForward = /** @class */ (function (_super) { __extends(ECommandShapeTreeBringForward, _super); /** * * @param indices indices of moved children sorted in the "descending" order * @param parent * @param selection */ function ECommandShapeTreeBringForward(indices, parent, selection) { var _this = _super.call(this) || this; _this._indices = indices; _this._parent = parent; _this._selection = selection; return _this; } Object.defineProperty(ECommandShapeTreeBringForward.prototype, "indices", { get: function () { return this._indices; }, enumerable: false, configurable: true }); Object.defineProperty(ECommandShapeTreeBringForward.prototype, "parent", { get: function () { return this._parent; }, enumerable: false, configurable: true }); Object.defineProperty(ECommandShapeTreeBringForward.prototype, "selection", { get: function () { return this._selection; }, enumerable: false, configurable: true }); ECommandShapeTreeBringForward.prototype.execute = function () { return true; }; ECommandShapeTreeBringForward.prototype.redo = function () { var indices = this._indices; var parent = this._parent; var children = parent.children; for (var i = 0, imax = indices.length; i < imax; ++i) { var index = indices[i]; var child = children[index]; children[index] = children[index + 1]; children[index + 1] = child; } parent.toDirty(); this._selection.update(EToolSelectSelectionUpdatedPart.TREE); return true; }; ECommandShapeTreeBringForward.prototype.undo = function () { var indices = this._indices; var parent = this._parent; var children = parent.children; for (var i = indices.length - 1; 0 <= i; --i) { var index = indices[i]; var child = children[index + 1]; children[index + 1] = children[index]; children[index] = child; } parent.toDirty(); this._selection.update(EToolSelectSelectionUpdatedPart.TREE); return true; }; ECommandShapeTreeBringForward.prototype.destroy = function () { this._indices.length = 0; }; return ECommandShapeTreeBringForward; }(DCommandBase)); export { ECommandShapeTreeBringForward }; //# sourceMappingURL=e-command-shape-tree-bring-forward.js.map