UNPKG

@wcardinal/wcardinal-geditor

Version:

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

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