@wcardinal/wcardinal-geditor
Version:
WebGL-based graphic editor, tester and viewer for supervisory systems
48 lines • 1.84 kB
JavaScript
import { __extends } from "tslib";
import { DCommandBase } from "@wcardinal/wcardinal-ui";
import { EShapeButtonLayer } from "./e-shape-button-layer";
var ECommandShapeButtonLayerValueMargin = /** @class */ (function (_super) {
__extends(ECommandShapeButtonLayerValueMargin, _super);
function ECommandShapeButtonLayerValueMargin(value, selection) {
var _this = _super.call(this) || this;
var shapes = selection.get();
var values = [];
for (var i = 0, imax = shapes.length; i < imax; ++i) {
var shape = shapes[i];
if (shape instanceof EShapeButtonLayer) {
values.push(shape.button.margin);
shape.button.margin = value;
}
else {
values.push(0);
}
}
_this._values = values;
_this._selection = selection;
return _this;
}
ECommandShapeButtonLayerValueMargin.prototype.execute = function () {
return true;
};
ECommandShapeButtonLayerValueMargin.prototype.redo = function () {
var selection = this._selection;
var shapes = selection.get();
var values = [];
for (var i = 0, imax = shapes.length; i < imax; ++i) {
var shape = shapes[i];
if (shape instanceof EShapeButtonLayer) {
var value = values[i];
values[i] = shape.button.margin;
shape.button.margin = value;
}
}
selection.update("PROPERTY");
return true;
};
ECommandShapeButtonLayerValueMargin.prototype.undo = function () {
return this.redo();
};
return ECommandShapeButtonLayerValueMargin;
}(DCommandBase));
export { ECommandShapeButtonLayerValueMargin };
//# sourceMappingURL=e-command-shape-button-layer-value-margin.js.map