UNPKG

@wcardinal/wcardinal-geditor

Version:

WebGL-based graphic editor, tester and viewer for supervisory systems

441 lines 19.5 kB
import { __extends } from "tslib"; import { DButtonCheckRight, DInputInteger, DLayoutHorizontal, DLayoutVertical, DPane, DText, DThemes } from "@wcardinal/wcardinal-ui"; import { EShapeChartLine } from "./e-shape-chart-line"; import { EShapeChartAxes } from "./e-shape-chart-axes"; var EEditorShapeChartLine = /** @class */ (function (_super) { __extends(EEditorShapeChartLine, _super); function EEditorShapeChartLine(options) { var _this = _super.call(this, options) || this; var selection = options.selection; _this.state.isDisabled = selection.isEmpty(); selection.on("change", function () { _this.state.isDisabled = selection.isEmpty(); }); var subtheme = _this.subtheme; new DLayoutVertical({ parent: _this.content, x: "padding", y: "padding", width: "padding", height: "auto", children: [ _this.newTextLabel(), new DButtonCheckRight({ width: "100%", text: { value: subtheme.getCheckXAxisLabel() }, padding: 0, background: { color: null }, on: { init: function (self) { var update = function () { var last = selection.last(); if (last instanceof EShapeChartLine) { self.state.isActive = EShapeChartAxes.getXAxis(last) != null; self.state.isDisabled = false; } else { self.state.isDisabled = true; } }; update(); selection.on("change", update); }, active: function () { EShapeChartAxes.createXAxis(selection); }, inactive: function () { EShapeChartAxes.deleteXAxis(selection); } } }), new DButtonCheckRight({ width: "100%", text: { value: subtheme.getCheckXAxisMajorTickLabel() }, padding: { top: 0, right: 0, left: 10, bottom: 0 }, background: { color: null }, on: { init: function (self) { var update = function () { var last = selection.last(); if (last instanceof EShapeChartLine) { if (EShapeChartAxes.getXAxis(last) != null) { self.state.isActive = EShapeChartAxes.getXAxisTickMajor(last) != null; self.state.isDisabled = false; } else { self.state.isDisabled = true; } } else { self.state.isDisabled = true; } }; update(); selection.on("change", update); }, active: function () { EShapeChartAxes.createXAxisTickMajor(selection); }, inactive: function () { EShapeChartAxes.deleteXAxisTickMajor(selection); } } }), new DButtonCheckRight({ width: "100%", text: { value: subtheme.getCheckXAxisMinorTickLabel() }, padding: { top: 0, right: 0, left: 10, bottom: 0 }, background: { color: null }, on: { init: function (self) { var update = function () { var last = selection.last(); if (last instanceof EShapeChartLine) { if (EShapeChartAxes.getXAxis(last) != null) { self.state.isActive = EShapeChartAxes.getXAxisTickMinor(last) != null; self.state.isDisabled = false; } else { self.state.isDisabled = true; } } else { self.state.isDisabled = true; } }; update(); selection.on("change", update); }, active: function () { EShapeChartAxes.createXAxisTickMinor(selection); }, inactive: function () { EShapeChartAxes.deleteXAxisTickMinor(selection); } } }), new DButtonCheckRight({ width: "100%", text: { value: subtheme.getCheckYAxisLabel() }, padding: 0, background: { color: null }, on: { init: function (self) { var update = function () { var last = selection.last(); if (last instanceof EShapeChartLine) { self.state.isActive = EShapeChartAxes.getYAxis(last) != null; self.state.isDisabled = false; } else { self.state.isDisabled = true; } }; update(); selection.on("change", update); }, active: function () { EShapeChartAxes.createYAxis(selection); }, inactive: function () { EShapeChartAxes.deleteYAxis(selection); } } }), new DButtonCheckRight({ width: "100%", text: { value: subtheme.getCheckYAxisMajorTickLabel() }, padding: { top: 0, right: 0, left: 10, bottom: 0 }, background: { color: null }, on: { init: function (self) { var update = function () { var last = selection.last(); if (last instanceof EShapeChartLine) { if (EShapeChartAxes.getYAxis(last) != null) { self.state.isActive = EShapeChartAxes.getYAxisTickMajor(last) != null; self.state.isDisabled = false; } else { self.state.isDisabled = true; } } else { self.state.isDisabled = true; } }; update(); selection.on("change", update); }, active: function () { EShapeChartAxes.createYAxisTickMajor(selection); }, inactive: function () { EShapeChartAxes.deleteYAxisTickMajor(selection); } } }), new DButtonCheckRight({ width: "100%", text: { value: subtheme.getCheckYAxisMinorTickLabel() }, padding: { top: 0, right: 0, left: 10, bottom: 0 }, background: { color: null }, on: { init: function (self) { var update = function () { var last = selection.last(); if (last instanceof EShapeChartLine) { if (EShapeChartAxes.getYAxis(last) != null) { self.state.isActive = EShapeChartAxes.getYAxisTickMinor(last) != null; self.state.isDisabled = false; } else { self.state.isDisabled = true; } } else { self.state.isDisabled = true; } }; update(); selection.on("change", update); }, active: function () { EShapeChartAxes.createYAxisTickMinor(selection); }, inactive: function () { EShapeChartAxes.deleteYAxisTickMinor(selection); } } }), new DText({ width: "100%", text: { value: subtheme.getTextMajorTickCountLabel() } }), new DLayoutHorizontal({ width: "100%", children: [ new DInputInteger({ weight: 1, min: 0, on: { init: function (self) { var update = function () { var last = selection.last(); if (last instanceof EShapeChartLine) { self.value = last.axis.x.tick.major.count; } }; update(); selection.on("change", update); }, change: function (count) { EShapeChartAxes.setXAxisTickMajorCount(count, selection); } } }), new DInputInteger({ weight: 1, min: 0, on: { init: function (self) { var update = function () { var last = selection.last(); if (last instanceof EShapeChartLine) { self.value = last.axis.y.tick.major.count; } }; update(); selection.on("change", update); }, change: function (count) { EShapeChartAxes.setYAxisTickMajorCount(count, selection); } } }) ] }), new DText({ width: "100%", text: { value: subtheme.getTextMinorTickCountLabel() } }), new DLayoutHorizontal({ width: "100%", children: [ new DInputInteger({ weight: 1, min: 0, on: { init: function (self) { var update = function () { var last = selection.last(); if (last instanceof EShapeChartLine) { self.value = last.axis.x.tick.minor.count; } }; update(); selection.on("change", update); }, change: function (count) { EShapeChartAxes.setXAxisTickMinorCount(count, selection); } } }), new DInputInteger({ weight: 1, min: 0, on: { init: function (self) { var update = function () { var last = selection.last(); if (last instanceof EShapeChartLine) { self.value = last.axis.y.tick.minor.count; } }; update(); selection.on("change", update); }, change: function (count) { EShapeChartAxes.setYAxisTickMinorCount(count, selection); } } }) ] }), new DText({ width: "100%", text: { value: subtheme.getTextPaddingLabel() } }), new DLayoutHorizontal({ width: "100%", children: [ new DInputInteger({ weight: 1, min: 0, on: { init: function (self) { var update = function () { var last = selection.last(); if (last instanceof EShapeChartLine) { self.value = last.axis.x.padding; } }; update(); selection.on("change", update); }, change: function (padding) { EShapeChartAxes.setXAxisPadding(padding, selection); } } }), new DInputInteger({ weight: 1, min: 0, on: { init: function (self) { var update = function () { var last = selection.last(); if (last instanceof EShapeChartLine) { self.value = last.axis.y.padding; } }; update(); selection.on("change", update); }, change: function (padding) { EShapeChartAxes.setYAxisPadding(padding, selection); } } }) ] }) ], on: { init: function (self) { var update = function () { self.state.isDisabled = !(selection.last() instanceof EShapeChartLine); }; update(); selection.on("change", update); } } }); return _this; } EEditorShapeChartLine.prototype.newTextLabel = function () { return new DText({ width: "100%", text: { value: this.subtheme.getLabel() } }); }; Object.defineProperty(EEditorShapeChartLine.prototype, "subtheme", { get: function () { var _a; return ((_a = this._subtheme) !== null && _a !== void 0 ? _a : (this._subtheme = this.newSubtheme())); }, enumerable: false, configurable: true }); EEditorShapeChartLine.prototype.newSubtheme = function () { return DThemes.get("EEditorShapeChartLine"); }; return EEditorShapeChartLine; }(DPane)); export { EEditorShapeChartLine }; //# sourceMappingURL=e-editor-shape-chart-line.js.map