@wcardinal/wcardinal-geditor
Version:
WebGL-based graphic editor, tester and viewer for supervisory systems
78 lines • 2.75 kB
JavaScript
import { __extends } from "tslib";
import { DCommandBase } from "@wcardinal/wcardinal-ui";
var ECommandShapeActionValueRemove = /** @class */ (function (_super) {
__extends(ECommandShapeActionValueRemove, _super);
function ECommandShapeActionValueRemove(target, selection) {
var _this = _super.call(this) || this;
_this._selection = selection;
_this._target = target;
_this._indices = [];
return _this;
}
Object.defineProperty(ECommandShapeActionValueRemove.prototype, "selection", {
get: function () {
return this._selection;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ECommandShapeActionValueRemove.prototype, "target", {
get: function () {
return this._target;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ECommandShapeActionValueRemove.prototype, "indices", {
get: function () {
return this._indices;
},
enumerable: false,
configurable: true
});
ECommandShapeActionValueRemove.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.remove(index);
}
}
this._selection.update("PROPERTY");
return true;
};
ECommandShapeActionValueRemove.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];
var index = indices[i];
if (0 <= index) {
shape.action.remove(index);
}
}
this._selection.update("PROPERTY");
return true;
};
ECommandShapeActionValueRemove.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];
var index = indices[i];
if (0 <= index) {
shape.action.add(target, index);
}
}
this._selection.update("PROPERTY");
return true;
};
return ECommandShapeActionValueRemove;
}(DCommandBase));
export { ECommandShapeActionValueRemove };
//# sourceMappingURL=e-command-shape-action-value-remove.js.map