@wcardinal/wcardinal-geditor
Version:
WebGL-based graphic editor, tester and viewer for supervisory systems
51 lines • 1.7 kB
JavaScript
import { __extends } from "tslib";
import { DCommandBase } from "@wcardinal/wcardinal-ui";
var ECommandDocumentWidth = /** @class */ (function (_super) {
__extends(ECommandDocumentWidth, _super);
function ECommandDocumentWidth(diagram, canvas, width) {
var _this = _super.call(this) || this;
_this._diagram = diagram;
_this._canvas = canvas;
_this._width = width;
return _this;
}
Object.defineProperty(ECommandDocumentWidth.prototype, "diagram", {
get: function () {
return this._diagram;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ECommandDocumentWidth.prototype, "canvas", {
get: function () {
return this._canvas;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ECommandDocumentWidth.prototype, "width", {
get: function () {
return this._width;
},
enumerable: false,
configurable: true
});
ECommandDocumentWidth.prototype.execute = function () {
return this.redo();
};
ECommandDocumentWidth.prototype.redo = function () {
var canvas = this._canvas;
var width = this._width;
this._width = canvas.width;
canvas.x = canvas.x + (canvas.width - width) * 0.5;
canvas.width = width;
this._diagram.emit("change", this._diagram);
return true;
};
ECommandDocumentWidth.prototype.undo = function () {
return this.redo();
};
return ECommandDocumentWidth;
}(DCommandBase));
export { ECommandDocumentWidth };
//# sourceMappingURL=e-command-document-width.js.map