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