UNPKG

@wcardinal/wcardinal-geditor

Version:

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

63 lines 2.4 kB
import { __extends } from "tslib"; import { DCommandBase } from "@wcardinal/wcardinal-ui"; import { EShapeTable } from "./e-shape-table"; var ECommandShapeTableColumnValueRemove = /** @class */ (function (_super) { __extends(ECommandShapeTableColumnValueRemove, _super); function ECommandShapeTableColumnValueRemove(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]; if (shape instanceof EShapeTable) { var index = shape.column.indexOf(target); indices.push(index); if (0 <= index) { shape.column.remove(index); } } } _this._indices = indices; _this._selection.update("PROPERTY"); return _this; } ECommandShapeTableColumnValueRemove.prototype.execute = function () { return true; }; ECommandShapeTableColumnValueRemove.prototype.redo = function () { var indices = this._indices; var shapes = this._selection.get(); for (var i = 0, imax = shapes.length; i < imax; ++i) { var shape = shapes[i]; if (shape instanceof EShapeTable) { var index = indices[i]; if (0 <= index) { shape.column.remove(index); } } } this._selection.update("PROPERTY"); return true; }; ECommandShapeTableColumnValueRemove.prototype.undo = 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]; if (shape instanceof EShapeTable) { var index = indices[i]; if (0 <= index) { shape.column.add(target, index); } } } this._selection.update("PROPERTY"); return true; }; return ECommandShapeTableColumnValueRemove; }(DCommandBase)); export { ECommandShapeTableColumnValueRemove }; //# sourceMappingURL=e-command-shape-table-column-value-remove.js.map