@wcardinal/wcardinal-geditor
Version:
WebGL-based graphic editor, tester and viewer for supervisory systems
55 lines • 2.2 kB
JavaScript
import { __extends } from "tslib";
import { DCommandBase } from "@wcardinal/wcardinal-ui";
import { EShapeTable } from "./e-shape-table";
var ECommandShapeTableColumnValueSendBackward = /** @class */ (function (_super) {
__extends(ECommandShapeTableColumnValueSendBackward, _super);
function ECommandShapeTableColumnValueSendBackward(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 column = shape.column;
var index = column.indexOf(target);
indices.push(index);
if (0 <= index && index < column.size() - 1) {
column.swap(index + 1, index);
}
}
else {
indices.push(-1);
}
}
_this._indices = indices;
_this._selection.update("PROPERTY");
return _this;
}
ECommandShapeTableColumnValueSendBackward.prototype.execute = function () {
return true;
};
ECommandShapeTableColumnValueSendBackward.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];
if (shape instanceof EShapeTable) {
var column = shape.column;
var index = indices[i];
if (0 <= index && index < column.size() - 1) {
column.swap(index + 1, index);
}
}
}
this._selection.update("PROPERTY");
return true;
};
ECommandShapeTableColumnValueSendBackward.prototype.undo = function () {
return this.redo();
};
return ECommandShapeTableColumnValueSendBackward;
}(DCommandBase));
export { ECommandShapeTableColumnValueSendBackward };
//# sourceMappingURL=e-command-shape-table-column-value-send-backward.js.map