@wcardinal/wcardinal-geditor
Version:
WebGL-based graphic editor, tester and viewer for supervisory systems
49 lines • 1.74 kB
JavaScript
import { __extends } from "tslib";
import { DCommandBase } from "@wcardinal/wcardinal-ui";
var ECommandShapeDataValueAdd = /** @class */ (function (_super) {
__extends(ECommandShapeDataValueAdd, _super);
function ECommandShapeDataValueAdd(value, selection) {
var _this = _super.call(this) || this;
_this._selection = selection;
_this._value = value;
return _this;
}
Object.defineProperty(ECommandShapeDataValueAdd.prototype, "selection", {
get: function () {
return this._selection;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ECommandShapeDataValueAdd.prototype, "value", {
get: function () {
return this._value;
},
enumerable: false,
configurable: true
});
ECommandShapeDataValueAdd.prototype.execute = function () {
return this.redo();
};
ECommandShapeDataValueAdd.prototype.redo = function () {
var value = this._value;
var shapes = this._selection.get();
for (var i = 0, imax = shapes.length; i < imax; ++i) {
shapes[i].data.add(value);
}
this._selection.update("PROPERTY");
return true;
};
ECommandShapeDataValueAdd.prototype.undo = function () {
var shapes = this._selection.get();
for (var i = 0, imax = shapes.length; i < imax; ++i) {
var shape = shapes[i];
shape.data.remove(shape.data.size() - 1);
}
this._selection.update("PROPERTY");
return true;
};
return ECommandShapeDataValueAdd;
}(DCommandBase));
export { ECommandShapeDataValueAdd };
//# sourceMappingURL=e-command-shape-data-value-add.js.map