@itwin/frontend-devtools
Version:
Debug menu and supporting UI widgets
92 lines • 3.88 kB
JavaScript
"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.DiagnosticsPanel = void 0;
/** @packageDocumentation
* @module Widgets
*/
const core_bentley_1 = require("@itwin/core-bentley");
const FpsTracker_1 = require("./FpsTracker");
const GpuProfiler_1 = require("./GpuProfiler");
const KeyinField_1 = require("./KeyinField");
const MemoryTracker_1 = require("./MemoryTracker");
const RenderCommandBreakdown_1 = require("./RenderCommandBreakdown");
const TileMemoryBreakdown_1 = require("./TileMemoryBreakdown");
const TileStatisticsTracker_1 = require("./TileStatisticsTracker");
const ToolSettingsTracker_1 = require("./ToolSettingsTracker");
/** Consolidates many other widgets into a single panel.
* @beta
*/
class DiagnosticsPanel {
_element;
_parentElement;
_fpsTracker;
_memoryTracker;
_tileMemoryBreakdown;
_renderCommands;
_statsTracker;
_gpuProfiler;
_toolSettingsTracker;
keyinField;
constructor(vp, props) {
const exclude = (undefined !== props && undefined !== props.exclude) ? props.exclude : {};
this._element = document.createElement("div");
this._element.className = "debugPanel";
if (true !== exclude.fps) {
this._fpsTracker = new FpsTracker_1.FpsTracker(this._element, vp);
this.addSeparator();
}
if (true !== exclude.keyin) {
this.keyinField = new KeyinField_1.KeyinField({
parent: this._element,
baseId: "diagnosticsPanelKeyin",
wantButton: true,
wantLabel: true,
historyLength: 20,
});
this.addSeparator();
}
if (true !== exclude.tileStats) {
this._statsTracker = new TileStatisticsTracker_1.TileStatisticsTracker(this._element, vp);
this.addSeparator();
}
if (true !== exclude.tileMemoryBreakdown) {
this._tileMemoryBreakdown = new TileMemoryBreakdown_1.TileMemoryBreakdown(this._element);
this.addSeparator();
}
if (!exclude.renderCommands) {
this._renderCommands = new RenderCommandBreakdown_1.RenderCommandBreakdown(this._element);
this.addSeparator();
}
if (true !== exclude.memory) {
this._memoryTracker = new MemoryTracker_1.MemoryTracker(this._element, vp);
this.addSeparator();
}
if (true !== exclude.gpuProfiler) {
this._gpuProfiler = new GpuProfiler_1.GpuProfiler(this._element);
this.addSeparator();
}
if (true !== exclude.toolSettings)
this._toolSettingsTracker = new ToolSettingsTracker_1.ToolSettingsTracker(this._element, vp);
}
get element() { return this._element; }
[Symbol.dispose]() {
(0, core_bentley_1.dispose)(this._fpsTracker);
(0, core_bentley_1.dispose)(this._memoryTracker);
(0, core_bentley_1.dispose)(this._tileMemoryBreakdown);
(0, core_bentley_1.dispose)(this._renderCommands);
(0, core_bentley_1.dispose)(this._statsTracker);
(0, core_bentley_1.dispose)(this._gpuProfiler);
(0, core_bentley_1.dispose)(this._toolSettingsTracker);
if (undefined !== this._parentElement)
this._parentElement.removeChild(this._element);
}
addSeparator() {
this._element.appendChild(document.createElement("hr"));
}
}
exports.DiagnosticsPanel = DiagnosticsPanel;
//# sourceMappingURL=DiagnosticsPanel.js.map