@wcardinal/wcardinal-geditor
Version:
WebGL-based graphic editor, tester and viewer for supervisory systems
76 lines • 2.8 kB
JavaScript
import { __extends } from "tslib";
import { DCommandBase } from "@wcardinal/wcardinal-ui";
import { EToolSelectSelectionUpdatedPart } from "../tool/e-tool-select-selection-updated-part";
var ECommandShapeTreeSendBackward = /** @class */ (function (_super) {
__extends(ECommandShapeTreeSendBackward, _super);
/**
* @param indices indices of moved children sorted in the "ascending" order
* @param parent
* @param selection
*/
function ECommandShapeTreeSendBackward(indices, parent, selection) {
var _this = _super.call(this) || this;
_this._indices = indices;
_this._parent = parent;
_this._selection = selection;
return _this;
}
Object.defineProperty(ECommandShapeTreeSendBackward.prototype, "indices", {
get: function () {
return this._indices;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ECommandShapeTreeSendBackward.prototype, "parent", {
get: function () {
return this._parent;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ECommandShapeTreeSendBackward.prototype, "selection", {
get: function () {
return this._selection;
},
enumerable: false,
configurable: true
});
ECommandShapeTreeSendBackward.prototype.execute = function () {
return true;
};
ECommandShapeTreeSendBackward.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;
};
ECommandShapeTreeSendBackward.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;
};
ECommandShapeTreeSendBackward.prototype.destroy = function () {
this._indices.length = 0;
};
return ECommandShapeTreeSendBackward;
}(DCommandBase));
export { ECommandShapeTreeSendBackward };
//# sourceMappingURL=e-command-shape-tree-send-backward.js.map