UNPKG

@wcardinal/wcardinal-geditor

Version:

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

68 lines 2.48 kB
import { __extends } from "tslib"; import { DCommandBase } from "@wcardinal/wcardinal-ui"; var ECommandShapeActionValueBringForward = /** @class */ (function (_super) { __extends(ECommandShapeActionValueBringForward, _super); function ECommandShapeActionValueBringForward(target, selection) { var _this = _super.call(this) || this; _this._selection = selection; _this._target = target; _this._indices = []; return _this; } Object.defineProperty(ECommandShapeActionValueBringForward.prototype, "selection", { get: function () { return this._selection; }, enumerable: false, configurable: true }); Object.defineProperty(ECommandShapeActionValueBringForward.prototype, "target", { get: function () { return this._target; }, enumerable: false, configurable: true }); Object.defineProperty(ECommandShapeActionValueBringForward.prototype, "indices", { get: function () { return this._indices; }, enumerable: false, configurable: true }); ECommandShapeActionValueBringForward.prototype.execute = function () { var target = this._target; var indices = this._indices; var shapes = this._selection.get(); for (var i = 0, imax = shapes.length; i < imax; ++i) { var shape = shapes[i]; var index = shape.action.indexOf(target); indices.push(index); if (0 < index) { shape.action.swap(index - 1, index); } } this._indices = indices; this._selection.update("PROPERTY"); return true; }; ECommandShapeActionValueBringForward.prototype.redo = function () { var shapes = this._selection.get(); var indices = this._indices; for (var i = 0, imax = shapes.length; i < imax; ++i) { var shape = shapes[i]; var index = indices[i]; if (0 < index) { shape.action.swap(index - 1, index); } } this._selection.update("PROPERTY"); return true; }; ECommandShapeActionValueBringForward.prototype.undo = function () { return this.redo(); }; return ECommandShapeActionValueBringForward; }(DCommandBase)); export { ECommandShapeActionValueBringForward }; //# sourceMappingURL=e-command-shape-action-value-bring-forward.js.map