UNPKG

@wcardinal/wcardinal-geditor

Version:

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

54 lines 2.66 kB
import { DThemes } from "@wcardinal/wcardinal-ui"; import { UtilCanvasCategory } from "./util-canvas-category"; var UtilCanvas = /** @class */ (function () { function UtilCanvas(options) { this._category = new UtilCanvasCategory(options === null || options === void 0 ? void 0 : options.category); this._options = options; } UtilCanvas.prototype.get = function () { var _a; return ((_a = this._promise) !== null && _a !== void 0 ? _a : (this._promise = this.fetch())); }; UtilCanvas.prototype.fetch = function () { var _this = this; return this._category.get().then(function (category) { return _this.toDefault(category); }); }; UtilCanvas.prototype.toDefault = function (category) { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; var theme = DThemes.get("EEditorCanvas"); var options = this._options; if (options != null) { return { name: (_a = options.name) !== null && _a !== void 0 ? _a : theme.getDefaultName(), label: (_b = options.label) !== null && _b !== void 0 ? _b : theme.getDefaultLabel(), width: (_c = options.width) !== null && _c !== void 0 ? _c : theme.getDefaultWidth(), height: (_d = options.height) !== null && _d !== void 0 ? _d : theme.getDefaultHeight(), category: category, summary: (_e = options.summary) !== null && _e !== void 0 ? _e : theme.getDefaultSummary(), description: (_f = options.description) !== null && _f !== void 0 ? _f : theme.getDefaultDescription(), background: { color: (_h = (_g = options.background) === null || _g === void 0 ? void 0 : _g.color) !== null && _h !== void 0 ? _h : theme.getDefaultBackgroundColor(), alpha: (_k = (_j = options.background) === null || _j === void 0 ? void 0 : _j.alpha) !== null && _k !== void 0 ? _k : theme.getDefaultBackgroundAlpha() } }; } return { name: theme.getDefaultName(), label: theme.getDefaultLabel(), width: theme.getDefaultWidth(), height: theme.getDefaultHeight(), category: category, summary: theme.getDefaultSummary(), description: theme.getDefaultDescription(), background: { color: theme.getDefaultBackgroundColor(), alpha: theme.getDefaultBackgroundAlpha() } }; }; return UtilCanvas; }()); export { UtilCanvas }; //# sourceMappingURL=util-canvas.js.map