@itwin/frontend-devtools 3.0.0-dev.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +723 -0
- package/LICENSE.md +9 -0
- package/README.md +321 -0
- package/lib/ClipboardUtilities.d.ts +9 -0
- package/lib/ClipboardUtilities.d.ts.map +1 -0
- package/lib/ClipboardUtilities.js +27 -0
- package/lib/ClipboardUtilities.js.map +1 -0
- package/lib/FrontEndDevTools.d.ts +19 -0
- package/lib/FrontEndDevTools.d.ts.map +1 -0
- package/lib/FrontEndDevTools.js +203 -0
- package/lib/FrontEndDevTools.js.map +1 -0
- package/lib/effects/Convolution.d.ts +69 -0
- package/lib/effects/Convolution.d.ts.map +1 -0
- package/lib/effects/Convolution.js +166 -0
- package/lib/effects/Convolution.js.map +1 -0
- package/lib/effects/EffectTools.d.ts +34 -0
- package/lib/effects/EffectTools.d.ts.map +1 -0
- package/lib/effects/EffectTools.js +69 -0
- package/lib/effects/EffectTools.js.map +1 -0
- package/lib/effects/Explosion.d.ts +13 -0
- package/lib/effects/Explosion.d.ts.map +1 -0
- package/lib/effects/Explosion.js +168 -0
- package/lib/effects/Explosion.js.map +1 -0
- package/lib/effects/FlipImage.d.ts +31 -0
- package/lib/effects/FlipImage.d.ts.map +1 -0
- package/lib/effects/FlipImage.js +100 -0
- package/lib/effects/FlipImage.js.map +1 -0
- package/lib/effects/LensDistortion.d.ts +35 -0
- package/lib/effects/LensDistortion.d.ts.map +1 -0
- package/lib/effects/LensDistortion.js +110 -0
- package/lib/effects/LensDistortion.js.map +1 -0
- package/lib/effects/Random.d.ts +25 -0
- package/lib/effects/Random.d.ts.map +1 -0
- package/lib/effects/Random.js +50 -0
- package/lib/effects/Random.js.map +1 -0
- package/lib/effects/Saturation.d.ts +31 -0
- package/lib/effects/Saturation.d.ts.map +1 -0
- package/lib/effects/Saturation.js +86 -0
- package/lib/effects/Saturation.js.map +1 -0
- package/lib/effects/Snow.d.ts +77 -0
- package/lib/effects/Snow.d.ts.map +1 -0
- package/lib/effects/Snow.js +187 -0
- package/lib/effects/Snow.js.map +1 -0
- package/lib/effects/Vignette.d.ts +40 -0
- package/lib/effects/Vignette.d.ts.map +1 -0
- package/lib/effects/Vignette.js +109 -0
- package/lib/effects/Vignette.js.map +1 -0
- package/lib/frontend-devtools.d.ts +82 -0
- package/lib/frontend-devtools.d.ts.map +1 -0
- package/lib/frontend-devtools.js +98 -0
- package/lib/frontend-devtools.js.map +1 -0
- package/lib/public/locales/en/FrontendDevTools.json +449 -0
- package/lib/public/sprites/particle_explosion.png +0 -0
- package/lib/public/sprites/particle_flame.png +0 -0
- package/lib/public/sprites/particle_snow.png +0 -0
- package/lib/tools/AnimationIntervalTool.d.ts +16 -0
- package/lib/tools/AnimationIntervalTool.d.ts.map +1 -0
- package/lib/tools/AnimationIntervalTool.js +31 -0
- package/lib/tools/AnimationIntervalTool.js.map +1 -0
- package/lib/tools/ChangeUnitsTool.d.ts +16 -0
- package/lib/tools/ChangeUnitsTool.d.ts.map +1 -0
- package/lib/tools/ChangeUnitsTool.js +42 -0
- package/lib/tools/ChangeUnitsTool.js.map +1 -0
- package/lib/tools/ClipTools.d.ts +68 -0
- package/lib/tools/ClipTools.d.ts.map +1 -0
- package/lib/tools/ClipTools.js +162 -0
- package/lib/tools/ClipTools.js.map +1 -0
- package/lib/tools/DisplayStyleTools.d.ts +99 -0
- package/lib/tools/DisplayStyleTools.d.ts.map +1 -0
- package/lib/tools/DisplayStyleTools.js +242 -0
- package/lib/tools/DisplayStyleTools.js.map +1 -0
- package/lib/tools/EmphasizeElementsTool.d.ts +61 -0
- package/lib/tools/EmphasizeElementsTool.d.ts.map +1 -0
- package/lib/tools/EmphasizeElementsTool.js +155 -0
- package/lib/tools/EmphasizeElementsTool.js.map +1 -0
- package/lib/tools/FrustumDecoration.d.ts +58 -0
- package/lib/tools/FrustumDecoration.d.ts.map +1 -0
- package/lib/tools/FrustumDecoration.js +372 -0
- package/lib/tools/FrustumDecoration.js.map +1 -0
- package/lib/tools/InspectElementTool.d.ts +42 -0
- package/lib/tools/InspectElementTool.d.ts.map +1 -0
- package/lib/tools/InspectElementTool.js +185 -0
- package/lib/tools/InspectElementTool.js.map +1 -0
- package/lib/tools/MapLayerTool.d.ts +248 -0
- package/lib/tools/MapLayerTool.d.ts.map +1 -0
- package/lib/tools/MapLayerTool.js +462 -0
- package/lib/tools/MapLayerTool.js.map +1 -0
- package/lib/tools/MeasureTileLoadTime.d.ts +13 -0
- package/lib/tools/MeasureTileLoadTime.d.ts.map +1 -0
- package/lib/tools/MeasureTileLoadTime.js +61 -0
- package/lib/tools/MeasureTileLoadTime.js.map +1 -0
- package/lib/tools/ModelAppearanceTools.d.ts +87 -0
- package/lib/tools/ModelAppearanceTools.d.ts.map +1 -0
- package/lib/tools/ModelAppearanceTools.js +184 -0
- package/lib/tools/ModelAppearanceTools.js.map +1 -0
- package/lib/tools/PlanProjectionTools.d.ts +41 -0
- package/lib/tools/PlanProjectionTools.d.ts.map +1 -0
- package/lib/tools/PlanProjectionTools.js +150 -0
- package/lib/tools/PlanProjectionTools.js.map +1 -0
- package/lib/tools/PlanarMaskTools.d.ts +182 -0
- package/lib/tools/PlanarMaskTools.d.ts.map +1 -0
- package/lib/tools/PlanarMaskTools.js +366 -0
- package/lib/tools/PlanarMaskTools.js.map +1 -0
- package/lib/tools/ProjectExtents.d.ts +41 -0
- package/lib/tools/ProjectExtents.d.ts.map +1 -0
- package/lib/tools/ProjectExtents.js +108 -0
- package/lib/tools/ProjectExtents.js.map +1 -0
- package/lib/tools/RealityModelTools.d.ts +117 -0
- package/lib/tools/RealityModelTools.d.ts.map +1 -0
- package/lib/tools/RealityModelTools.js +269 -0
- package/lib/tools/RealityModelTools.js.map +1 -0
- package/lib/tools/RealityTransitionTool.d.ts +26 -0
- package/lib/tools/RealityTransitionTool.d.ts.map +1 -0
- package/lib/tools/RealityTransitionTool.js +110 -0
- package/lib/tools/RealityTransitionTool.js.map +1 -0
- package/lib/tools/RenderSystemTools.d.ts +46 -0
- package/lib/tools/RenderSystemTools.d.ts.map +1 -0
- package/lib/tools/RenderSystemTools.js +81 -0
- package/lib/tools/RenderSystemTools.js.map +1 -0
- package/lib/tools/RenderTargetTools.d.ts +101 -0
- package/lib/tools/RenderTargetTools.d.ts.map +1 -0
- package/lib/tools/RenderTargetTools.js +167 -0
- package/lib/tools/RenderTargetTools.js.map +1 -0
- package/lib/tools/ReportWebGLCompatibilityTool.d.ts +12 -0
- package/lib/tools/ReportWebGLCompatibilityTool.d.ts.map +1 -0
- package/lib/tools/ReportWebGLCompatibilityTool.js +31 -0
- package/lib/tools/ReportWebGLCompatibilityTool.js.map +1 -0
- package/lib/tools/SavedViews.d.ts +47 -0
- package/lib/tools/SavedViews.d.ts.map +1 -0
- package/lib/tools/SavedViews.js +137 -0
- package/lib/tools/SavedViews.js.map +1 -0
- package/lib/tools/SelectionTools.d.ts +17 -0
- package/lib/tools/SelectionTools.d.ts.map +1 -0
- package/lib/tools/SelectionTools.js +28 -0
- package/lib/tools/SelectionTools.js.map +1 -0
- package/lib/tools/SetGpuMemoryLimitTool.d.ts +16 -0
- package/lib/tools/SetGpuMemoryLimitTool.d.ts.map +1 -0
- package/lib/tools/SetGpuMemoryLimitTool.js +34 -0
- package/lib/tools/SetGpuMemoryLimitTool.js.map +1 -0
- package/lib/tools/SourceAspectIdTools.d.ts +41 -0
- package/lib/tools/SourceAspectIdTools.d.ts.map +1 -0
- package/lib/tools/SourceAspectIdTools.js +105 -0
- package/lib/tools/SourceAspectIdTools.js.map +1 -0
- package/lib/tools/TileRequestDecoration.d.ts +13 -0
- package/lib/tools/TileRequestDecoration.d.ts.map +1 -0
- package/lib/tools/TileRequestDecoration.js +84 -0
- package/lib/tools/TileRequestDecoration.js.map +1 -0
- package/lib/tools/TileTreeBoundsDecoration.d.ts +12 -0
- package/lib/tools/TileTreeBoundsDecoration.d.ts.map +1 -0
- package/lib/tools/TileTreeBoundsDecoration.js +75 -0
- package/lib/tools/TileTreeBoundsDecoration.js.map +1 -0
- package/lib/tools/ToolTipProvider.d.ts +16 -0
- package/lib/tools/ToolTipProvider.d.ts.map +1 -0
- package/lib/tools/ToolTipProvider.js +67 -0
- package/lib/tools/ToolTipProvider.js.map +1 -0
- package/lib/tools/ViewportTools.d.ts +194 -0
- package/lib/tools/ViewportTools.d.ts.map +1 -0
- package/lib/tools/ViewportTools.js +451 -0
- package/lib/tools/ViewportTools.js.map +1 -0
- package/lib/tools/parseArgs.d.ts +24 -0
- package/lib/tools/parseArgs.d.ts.map +1 -0
- package/lib/tools/parseArgs.js +52 -0
- package/lib/tools/parseArgs.js.map +1 -0
- package/lib/tools/parseBoolean.d.ts +9 -0
- package/lib/tools/parseBoolean.d.ts.map +1 -0
- package/lib/tools/parseBoolean.js +27 -0
- package/lib/tools/parseBoolean.js.map +1 -0
- package/lib/tools/parseToggle.d.ts +9 -0
- package/lib/tools/parseToggle.d.ts.map +1 -0
- package/lib/tools/parseToggle.js +26 -0
- package/lib/tools/parseToggle.js.map +1 -0
- package/lib/ui/Button.d.ts +30 -0
- package/lib/ui/Button.d.ts.map +1 -0
- package/lib/ui/Button.js +27 -0
- package/lib/ui/Button.js.map +1 -0
- package/lib/ui/CheckBox.d.ts +24 -0
- package/lib/ui/CheckBox.d.ts.map +1 -0
- package/lib/ui/CheckBox.js +28 -0
- package/lib/ui/CheckBox.js.map +1 -0
- package/lib/ui/ColorInput.d.ts +28 -0
- package/lib/ui/ColorInput.d.ts.map +1 -0
- package/lib/ui/ColorInput.js +54 -0
- package/lib/ui/ColorInput.js.map +1 -0
- package/lib/ui/ComboBox.d.ts +29 -0
- package/lib/ui/ComboBox.d.ts.map +1 -0
- package/lib/ui/ComboBox.js +43 -0
- package/lib/ui/ComboBox.js.map +1 -0
- package/lib/ui/DataList.d.ts +28 -0
- package/lib/ui/DataList.d.ts.map +1 -0
- package/lib/ui/DataList.js +40 -0
- package/lib/ui/DataList.js.map +1 -0
- package/lib/ui/NestedMenu.d.ts +20 -0
- package/lib/ui/NestedMenu.d.ts.map +1 -0
- package/lib/ui/NestedMenu.js +47 -0
- package/lib/ui/NestedMenu.js.map +1 -0
- package/lib/ui/NumericInput.d.ts +35 -0
- package/lib/ui/NumericInput.d.ts.map +1 -0
- package/lib/ui/NumericInput.js +60 -0
- package/lib/ui/NumericInput.js.map +1 -0
- package/lib/ui/RadioBox.d.ts +29 -0
- package/lib/ui/RadioBox.d.ts.map +1 -0
- package/lib/ui/RadioBox.js +77 -0
- package/lib/ui/RadioBox.js.map +1 -0
- package/lib/ui/Slider.d.ts +25 -0
- package/lib/ui/Slider.d.ts.map +1 -0
- package/lib/ui/Slider.js +33 -0
- package/lib/ui/Slider.js.map +1 -0
- package/lib/ui/TextBox.d.ts +33 -0
- package/lib/ui/TextBox.d.ts.map +1 -0
- package/lib/ui/TextBox.js +57 -0
- package/lib/ui/TextBox.js.map +1 -0
- package/lib/widgets/DiagnosticsPanel.d.ts +36 -0
- package/lib/widgets/DiagnosticsPanel.d.ts.map +1 -0
- package/lib/widgets/DiagnosticsPanel.js +76 -0
- package/lib/widgets/DiagnosticsPanel.js.map +1 -0
- package/lib/widgets/FpsTracker.d.ts +20 -0
- package/lib/widgets/FpsTracker.d.ts.map +1 -0
- package/lib/widgets/FpsTracker.js +57 -0
- package/lib/widgets/FpsTracker.js.map +1 -0
- package/lib/widgets/GpuProfiler.d.ts +17 -0
- package/lib/widgets/GpuProfiler.d.ts.map +1 -0
- package/lib/widgets/GpuProfiler.js +193 -0
- package/lib/widgets/GpuProfiler.js.map +1 -0
- package/lib/widgets/KeyinField.d.ts +62 -0
- package/lib/widgets/KeyinField.d.ts.map +1 -0
- package/lib/widgets/KeyinField.js +188 -0
- package/lib/widgets/KeyinField.js.map +1 -0
- package/lib/widgets/MemoryTracker.d.ts +28 -0
- package/lib/widgets/MemoryTracker.d.ts.map +1 -0
- package/lib/widgets/MemoryTracker.js +244 -0
- package/lib/widgets/MemoryTracker.js.map +1 -0
- package/lib/widgets/TileMemoryBreakdown.d.ts +31 -0
- package/lib/widgets/TileMemoryBreakdown.d.ts.map +1 -0
- package/lib/widgets/TileMemoryBreakdown.js +205 -0
- package/lib/widgets/TileMemoryBreakdown.js.map +1 -0
- package/lib/widgets/TileStatisticsTracker.d.ts +22 -0
- package/lib/widgets/TileStatisticsTracker.d.ts.map +1 -0
- package/lib/widgets/TileStatisticsTracker.js +143 -0
- package/lib/widgets/TileStatisticsTracker.js.map +1 -0
- package/lib/widgets/ToolSettingsTracker.d.ts +10 -0
- package/lib/widgets/ToolSettingsTracker.d.ts.map +1 -0
- package/lib/widgets/ToolSettingsTracker.js +182 -0
- package/lib/widgets/ToolSettingsTracker.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.createLabeledNumericInput = exports.createNumericInput = void 0;
|
|
8
|
+
/** @alpha */
|
|
9
|
+
function createNumericInput(props, useFloat = false) {
|
|
10
|
+
const input = document.createElement("input");
|
|
11
|
+
input.type = "number";
|
|
12
|
+
input.value = props.value.toString();
|
|
13
|
+
input.onchange = () => {
|
|
14
|
+
try {
|
|
15
|
+
const value = useFloat ? parseFloat(input.value) : parseInt(input.value, 10);
|
|
16
|
+
if (!Number.isNaN(value))
|
|
17
|
+
props.handler(value, input);
|
|
18
|
+
}
|
|
19
|
+
catch (_ex) {
|
|
20
|
+
//
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
if (undefined !== props.id)
|
|
24
|
+
input.id = props.id;
|
|
25
|
+
if (undefined !== props.display)
|
|
26
|
+
input.style.display = props.display;
|
|
27
|
+
if (undefined !== props.min)
|
|
28
|
+
input.min = props.min.toString();
|
|
29
|
+
if (undefined !== props.max)
|
|
30
|
+
input.max = props.max.toString();
|
|
31
|
+
if (undefined !== props.step)
|
|
32
|
+
input.step = props.step.toString();
|
|
33
|
+
if (undefined !== props.tooltip)
|
|
34
|
+
input.title = props.tooltip;
|
|
35
|
+
if (undefined !== props.disabled)
|
|
36
|
+
input.disabled = props.disabled;
|
|
37
|
+
if (undefined !== props.parent)
|
|
38
|
+
props.parent.appendChild(input);
|
|
39
|
+
return input;
|
|
40
|
+
}
|
|
41
|
+
exports.createNumericInput = createNumericInput;
|
|
42
|
+
/** @alpha */
|
|
43
|
+
function createLabeledNumericInput(props) {
|
|
44
|
+
const div = document.createElement("div");
|
|
45
|
+
const label = document.createElement("label");
|
|
46
|
+
label.htmlFor = props.id;
|
|
47
|
+
label.innerText = props.name;
|
|
48
|
+
div.appendChild(label);
|
|
49
|
+
const inputProps = Object.assign({}, props);
|
|
50
|
+
inputProps.parent = div;
|
|
51
|
+
inputProps.display = "inline";
|
|
52
|
+
const input = createNumericInput(inputProps, true === props.parseAsFloat);
|
|
53
|
+
if (undefined !== props.parent)
|
|
54
|
+
props.parent.appendChild(div);
|
|
55
|
+
if (undefined !== props.tooltip)
|
|
56
|
+
div.title = props.tooltip;
|
|
57
|
+
return { label, div, input };
|
|
58
|
+
}
|
|
59
|
+
exports.createLabeledNumericInput = createLabeledNumericInput;
|
|
60
|
+
//# sourceMappingURL=NumericInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NumericInput.js","sourceRoot":"","sources":["../../src/ui/NumericInput.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAwB/F,aAAa;AACb,SAAgB,kBAAkB,CAAC,KAAwB,EAAE,WAAoB,KAAK;IACpF,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9C,KAAK,CAAC,IAAI,GAAG,QAAQ,CAAC;IACtB,KAAK,C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AK,CAAC,MAAM;QAAE,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAEhE,OAAO,KAAK,CAAC;AACf,CAAC;AAzBD,gDAyBC;AAeD,aAAa;AACb,SAAgB,yBAAyB,CAAC,KAA+B;IACvE,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAE1C,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9C,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,EAAE,CAAC;IACzB,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC;IAC7B,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAEvB,MAAM,UAAU,qBAAQ,KAAK,CAAE,CAAC;IAChC,UAAU,CAAC,MAAM,GAAG,GAAG,CAAC;IACxB,UAAU,CAAC,OAAO,GAAG,QAAQ,CAAC;IAC9B,MAAM,KAAK,GAAG,kBAAkB,CAAC,UAAU,EAAE,IAAI,KAAK,KAAK,CAAC,YAAY,CAAC,CAAC;IAE1E,IAAI,SAAS,KAAK,KAAK,CAAC,MAAM;QAC5B,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAEhC,IAAI,SAAS,KAAK,KAAK,CAAC,OAAO;QAC7B,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC;IAE5B,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;AAC/B,CAAC;AApBD,8DAoBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Controls\n */\n\n/** @alpha */\nexport type NumericInputHandler = (value: number, input: HTMLInputElement) => void;\n\n/** @alpha */\nexport interface NumericInputProps {\n handler: NumericInputHandler;\n id?: string;\n parent?: HTMLElement;\n value: number;\n display?: \"inline\" | \"none\" | \"block\";\n disabled?: boolean;\n min?: number;\n max?: number;\n step?: number;\n tooltip?: string;\n parseAsFloat?: true;\n}\n\n/** @alpha */\nexport function createNumericInput(props: NumericInputProps, useFloat: boolean = false): HTMLInputElement {\n const input = document.createElement(\"input\");\n input.type = \"number\";\n input.value = props.value.toString();\n\n input.onchange = () => {\n try {\n const value = useFloat ? parseFloat(input.value) : parseInt(input.value, 10);\n if (!Number.isNaN(value))\n props.handler(value, input);\n } catch (_ex) {\n //\n }\n };\n\n if (undefined !== props.id) input.id = props.id;\n if (undefined !== props.display) input.style.display = props.display;\n if (undefined !== props.min) input.min = props.min.toString();\n if (undefined !== props.max) input.max = props.max.toString();\n if (undefined !== props.step) input.step = props.step.toString();\n if (undefined !== props.tooltip) input.title = props.tooltip;\n if (undefined !== props.disabled) input.disabled = props.disabled;\n if (undefined !== props.parent) props.parent.appendChild(input);\n\n return input;\n}\n\n/** @alpha */\nexport interface LabeledNumericInputProps extends NumericInputProps {\n name: string;\n id: string;\n}\n\n/** @alpha */\nexport interface LabeledNumericInput {\n input: HTMLInputElement;\n div: HTMLDivElement;\n label: HTMLLabelElement;\n}\n\n/** @alpha */\nexport function createLabeledNumericInput(props: LabeledNumericInputProps): LabeledNumericInput {\n const div = document.createElement(\"div\");\n\n const label = document.createElement(\"label\");\n label.htmlFor = props.id;\n label.innerText = props.name;\n div.appendChild(label);\n\n const inputProps = { ...props };\n inputProps.parent = div;\n inputProps.display = \"inline\";\n const input = createNumericInput(inputProps, true === props.parseAsFloat);\n\n if (undefined !== props.parent)\n props.parent.appendChild(div);\n\n if (undefined !== props.tooltip)\n div.title = props.tooltip;\n\n return { label, div, input };\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Controls
|
|
3
|
+
*/
|
|
4
|
+
/** @alpha */
|
|
5
|
+
export interface RadioBoxEntry {
|
|
6
|
+
value: number | string | undefined;
|
|
7
|
+
label: string;
|
|
8
|
+
}
|
|
9
|
+
/** @alpha */
|
|
10
|
+
export declare type RadioBoxHandler = (value: string, form: HTMLFormElement) => void;
|
|
11
|
+
/** @alpha */
|
|
12
|
+
export interface RadioBoxProps {
|
|
13
|
+
id: string;
|
|
14
|
+
entries: RadioBoxEntry[];
|
|
15
|
+
handler: RadioBoxHandler;
|
|
16
|
+
name?: string;
|
|
17
|
+
parent?: HTMLElement;
|
|
18
|
+
defaultValue?: number | string;
|
|
19
|
+
vertical?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** @alpha */
|
|
22
|
+
export interface RadioBox {
|
|
23
|
+
label?: HTMLLabelElement;
|
|
24
|
+
setValue: (newValue: number | string) => boolean;
|
|
25
|
+
div: HTMLDivElement;
|
|
26
|
+
}
|
|
27
|
+
/** @alpha */
|
|
28
|
+
export declare function createRadioBox(props: RadioBoxProps): RadioBox;
|
|
29
|
+
//# sourceMappingURL=RadioBox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioBox.d.ts","sourceRoot":"","sources":["../../src/ui/RadioBox.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,aAAa;AACb,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,aAAa;AACb,oBAAY,eAAe,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,KAAK,IAAI,CAAC;AAE7E,aAAa;AACb,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,OAAO,EAAE,eAAe,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,aAAa;AACb,MAAM,WAAW,QAAQ;IACvB,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,KAAK,OAAO,CAAC;IACjD,GAAG,EAAE,cAAc,CAAC;CACrB;AAED,aAAa;AACb,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,QAAQ,CA4E7D"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.createRadioBox = void 0;
|
|
8
|
+
/** @alpha */
|
|
9
|
+
function createRadioBox(props) {
|
|
10
|
+
const div = document.createElement("div");
|
|
11
|
+
let label;
|
|
12
|
+
if (undefined !== props.name) {
|
|
13
|
+
label = document.createElement("label");
|
|
14
|
+
label.htmlFor = props.id;
|
|
15
|
+
label.innerText = props.name;
|
|
16
|
+
div.appendChild(label);
|
|
17
|
+
}
|
|
18
|
+
const form = document.createElement("form");
|
|
19
|
+
form.id = props.id;
|
|
20
|
+
const radioBoxes = [];
|
|
21
|
+
for (const entry of props.entries) {
|
|
22
|
+
const input = document.createElement("input");
|
|
23
|
+
input.type = "radio";
|
|
24
|
+
input.name = props.name ? props.name : props.id;
|
|
25
|
+
input.value = (undefined !== entry.value) ? entry.value.toString() : "";
|
|
26
|
+
const inputLabel = document.createElement("label");
|
|
27
|
+
inputLabel.innerText = entry.label;
|
|
28
|
+
inputLabel.onclick = () => {
|
|
29
|
+
try {
|
|
30
|
+
input.checked = true;
|
|
31
|
+
const value = input.value;
|
|
32
|
+
props.handler(value, form);
|
|
33
|
+
}
|
|
34
|
+
catch (_ex) {
|
|
35
|
+
//
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
input.onchange = () => {
|
|
39
|
+
try {
|
|
40
|
+
const value = input.value;
|
|
41
|
+
props.handler(value, form);
|
|
42
|
+
}
|
|
43
|
+
catch (_ex) {
|
|
44
|
+
//
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
if (props.defaultValue === entry.value) {
|
|
48
|
+
input.checked = true;
|
|
49
|
+
}
|
|
50
|
+
radioBoxes.push(input);
|
|
51
|
+
if (props.vertical) {
|
|
52
|
+
const container = document.createElement("div");
|
|
53
|
+
container.appendChild(input);
|
|
54
|
+
container.appendChild(inputLabel);
|
|
55
|
+
form.appendChild(container);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
form.appendChild(input);
|
|
59
|
+
form.appendChild(inputLabel);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
div.appendChild(form);
|
|
63
|
+
if (undefined !== props.parent)
|
|
64
|
+
props.parent.appendChild(div);
|
|
65
|
+
const setValue = (value) => {
|
|
66
|
+
const stringValue = value.toString();
|
|
67
|
+
const validValue = radioBoxes.map((input) => input.value).includes(stringValue);
|
|
68
|
+
if (validValue) {
|
|
69
|
+
radioBoxes.forEach((input) => input.checked = input.value === stringValue);
|
|
70
|
+
props.handler(stringValue, form);
|
|
71
|
+
}
|
|
72
|
+
return validValue;
|
|
73
|
+
};
|
|
74
|
+
return { div, label, setValue };
|
|
75
|
+
}
|
|
76
|
+
exports.createRadioBox = createRadioBox;
|
|
77
|
+
//# sourceMappingURL=RadioBox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioBox.js","sourceRoot":"","sources":["../../src/ui/RadioBox.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAiC/F,aAAa;AACb,SAAgB,cAAc,CAAC,KAAoB;IACjD,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAA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AC,WAAW,CAAC,CAAC;QACzF,IAAI,UAAU,EAAE;YACd,UAAU,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,KAAK,KAAK,WAAW,CAAC,CAAC;YAC3E,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;SAClC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;IAEF,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AAClC,CAAC;AA5ED,wCA4EC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Controls\n */\n\n/** @alpha */\nexport interface RadioBoxEntry {\n value: number | string | undefined;\n label: string;\n}\n\n/** @alpha */\nexport type RadioBoxHandler = (value: string, form: HTMLFormElement) => void;\n\n/** @alpha */\nexport interface RadioBoxProps {\n id: string;\n entries: RadioBoxEntry[];\n handler: RadioBoxHandler;\n name?: string;\n parent?: HTMLElement;\n defaultValue?: number | string;\n vertical?: boolean;\n}\n\n/** @alpha */\nexport interface RadioBox {\n label?: HTMLLabelElement;\n setValue: (newValue: number | string) => boolean;\n div: HTMLDivElement;\n}\n\n/** @alpha */\nexport function createRadioBox(props: RadioBoxProps): RadioBox {\n const div = document.createElement(\"div\");\n\n let label: HTMLLabelElement | undefined;\n if (undefined !== props.name) {\n label = document.createElement(\"label\");\n label.htmlFor = props.id;\n label.innerText = props.name;\n div.appendChild(label);\n }\n\n const form = document.createElement(\"form\");\n form.id = props.id;\n\n const radioBoxes: HTMLInputElement[] = [];\n\n for (const entry of props.entries) {\n const input = document.createElement(\"input\");\n input.type = \"radio\";\n input.name = props.name ? props.name : props.id;\n\n input.value = (undefined !== entry.value) ? entry.value.toString() : \"\";\n\n const inputLabel: HTMLLabelElement = document.createElement(\"label\");\n inputLabel.innerText = entry.label;\n\n inputLabel.onclick = () => {\n try {\n input.checked = true;\n const value = input.value;\n props.handler(value, form);\n } catch (_ex) {\n //\n }\n };\n\n input.onchange = () => {\n try {\n const value = input.value;\n props.handler(value, form);\n } catch (_ex) {\n //\n }\n };\n if (props.defaultValue === entry.value) {\n input.checked = true;\n }\n\n radioBoxes.push(input);\n\n if (props.vertical) {\n const container = document.createElement(\"div\");\n container.appendChild(input);\n container.appendChild(inputLabel);\n form.appendChild(container);\n } else {\n form.appendChild(input);\n form.appendChild(inputLabel);\n }\n }\n\n div.appendChild(form);\n if (undefined !== props.parent)\n props.parent.appendChild(div);\n\n const setValue = (value: number | string): boolean => {\n const stringValue = value.toString();\n const validValue: boolean = radioBoxes.map((input) => input.value).includes(stringValue);\n if (validValue) {\n radioBoxes.forEach((input) => input.checked = input.value === stringValue);\n props.handler(stringValue, form);\n }\n return validValue;\n };\n\n return { div, label, setValue };\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Controls
|
|
3
|
+
*/
|
|
4
|
+
/** @alpha */
|
|
5
|
+
export interface Slider {
|
|
6
|
+
label: HTMLLabelElement;
|
|
7
|
+
slider: HTMLInputElement;
|
|
8
|
+
div: HTMLDivElement;
|
|
9
|
+
}
|
|
10
|
+
/** @alpha */
|
|
11
|
+
export declare type SliderHandler = (slider: HTMLInputElement) => void;
|
|
12
|
+
/** @alpha */
|
|
13
|
+
export interface SliderProps {
|
|
14
|
+
name: string;
|
|
15
|
+
handler: SliderHandler;
|
|
16
|
+
id: string;
|
|
17
|
+
parent?: HTMLElement;
|
|
18
|
+
min: string;
|
|
19
|
+
max: string;
|
|
20
|
+
step: string;
|
|
21
|
+
value: string;
|
|
22
|
+
}
|
|
23
|
+
/** @alpha */
|
|
24
|
+
export declare function createSlider(props: SliderProps): Slider;
|
|
25
|
+
//# sourceMappingURL=Slider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Slider.d.ts","sourceRoot":"","sources":["../../src/ui/Slider.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,aAAa;AACb,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,gBAAgB,CAAC;IACxB,MAAM,EAAE,gBAAgB,CAAC;IACzB,GAAG,EAAE,cAAc,CAAC;CACrB;AAED,aAAa;AACb,oBAAY,aAAa,GAAG,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;AAE/D,aAAa;AACb,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,aAAa,CAAC;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,aAAa;AACb,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CA0BvD"}
|
package/lib/ui/Slider.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.createSlider = void 0;
|
|
8
|
+
/** @alpha */
|
|
9
|
+
function createSlider(props) {
|
|
10
|
+
const div = document.createElement("div");
|
|
11
|
+
div.style.display = "block";
|
|
12
|
+
div.style.verticalAlign = "middle";
|
|
13
|
+
div.style.textAlign = "right";
|
|
14
|
+
const label = document.createElement("label");
|
|
15
|
+
label.htmlFor = props.id;
|
|
16
|
+
label.innerText = props.name;
|
|
17
|
+
div.appendChild(label);
|
|
18
|
+
const slider = document.createElement("input");
|
|
19
|
+
slider.type = "range";
|
|
20
|
+
slider.className = "slider";
|
|
21
|
+
slider.id = props.id;
|
|
22
|
+
slider.min = props.min;
|
|
23
|
+
slider.max = props.max;
|
|
24
|
+
slider.step = props.step;
|
|
25
|
+
slider.value = props.value;
|
|
26
|
+
slider.addEventListener("input", () => props.handler(slider));
|
|
27
|
+
div.appendChild(slider);
|
|
28
|
+
if (undefined !== props.parent)
|
|
29
|
+
props.parent.appendChild(div);
|
|
30
|
+
return { label, slider, div };
|
|
31
|
+
}
|
|
32
|
+
exports.createSlider = createSlider;
|
|
33
|
+
//# sourceMappingURL=Slider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Slider.js","sourceRoot":"","sources":["../../src/ui/Slider.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AA4B/F,aAAa;AACb,SAAgB,YAAY,CAAC,KAAkB;IAC7C,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC1C,GAAG,CAAC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;IAC5B,GAAG,CAAC,KAAK,CAAC,aAAa,GAAG,QAAQ,CAAC;IACnC,GAAG,CAAC,KAAK,CAAC,SAAS,GAAG,OAAO,CAAC;IAE9B,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9C,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,EAAE,CAAC;IACzB,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC;IAC7B,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAEvB,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC/C,MAAM,CAAC,IAAI,GAAG,OAAO,CAAC;IACtB,MAAM,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,MAAM,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;IACrB,MAAM,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;IACvB,MAAM,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;IACvB,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IACzB,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAC3B,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9D,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAExB,IAAI,SAAS,KAAK,KAAK,CAAC,MAAM;QAC5B,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAEhC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AAChC,CAAC;AA1BD,oCA0BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Controls\n */\n\n/** @alpha */\nexport interface Slider {\n label: HTMLLabelElement;\n slider: HTMLInputElement;\n div: HTMLDivElement;\n}\n\n/** @alpha */\nexport type SliderHandler = (slider: HTMLInputElement) => void;\n\n/** @alpha */\nexport interface SliderProps {\n name: string;\n handler: SliderHandler;\n id: string;\n parent?: HTMLElement;\n min: string;\n max: string;\n step: string;\n value: string;\n}\n\n/** @alpha */\nexport function createSlider(props: SliderProps): Slider {\n const div = document.createElement(\"div\");\n div.style.display = \"block\";\n div.style.verticalAlign = \"middle\";\n div.style.textAlign = \"right\";\n\n const label = document.createElement(\"label\");\n label.htmlFor = props.id;\n label.innerText = props.name;\n div.appendChild(label);\n\n const slider = document.createElement(\"input\");\n slider.type = \"range\";\n slider.className = \"slider\";\n slider.id = props.id;\n slider.min = props.min;\n slider.max = props.max;\n slider.step = props.step;\n slider.value = props.value;\n slider.addEventListener(\"input\", () => props.handler(slider));\n div.appendChild(slider);\n\n if (undefined !== props.parent)\n props.parent.appendChild(div);\n\n return { label, slider, div };\n}\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Controls
|
|
3
|
+
*/
|
|
4
|
+
/** Wraps an HTML text input field.
|
|
5
|
+
* @beta
|
|
6
|
+
*/
|
|
7
|
+
export interface TextBox {
|
|
8
|
+
/** The label, if the text box has one. */
|
|
9
|
+
label?: HTMLLabelElement;
|
|
10
|
+
/** The text input element. */
|
|
11
|
+
textbox: HTMLInputElement;
|
|
12
|
+
/** The div containing the text box. */
|
|
13
|
+
div: HTMLDivElement;
|
|
14
|
+
}
|
|
15
|
+
/** @alpha */
|
|
16
|
+
export declare type TextBoxHandler = (textbox: HTMLInputElement) => void;
|
|
17
|
+
/** @alpha */
|
|
18
|
+
export declare type TextBoxKeyPressHandler = (textbox: HTMLInputElement, ev: KeyboardEvent) => void;
|
|
19
|
+
/** @alpha */
|
|
20
|
+
export interface TextBoxProps {
|
|
21
|
+
label?: string;
|
|
22
|
+
id?: string;
|
|
23
|
+
parent?: HTMLElement;
|
|
24
|
+
handler?: TextBoxHandler;
|
|
25
|
+
keypresshandler?: TextBoxKeyPressHandler;
|
|
26
|
+
focushandler?: TextBoxHandler;
|
|
27
|
+
tooltip?: string;
|
|
28
|
+
inline?: boolean;
|
|
29
|
+
list?: string;
|
|
30
|
+
}
|
|
31
|
+
/** @alpha */
|
|
32
|
+
export declare function createTextBox(props: TextBoxProps): TextBox;
|
|
33
|
+
//# sourceMappingURL=TextBox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextBox.d.ts","sourceRoot":"","sources":["../../src/ui/TextBox.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,8BAA8B;IAC9B,OAAO,EAAE,gBAAgB,CAAC;IAC1B,uCAAuC;IACvC,GAAG,EAAE,cAAc,CAAC;CACrB;AAED,aAAa;AACb,oBAAY,cAAc,GAAG,CAAC,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAC;AAEjE,aAAa;AACb,oBAAY,sBAAsB,GAAG,CAAC,OAAO,EAAE,gBAAgB,EAAE,EAAE,EAAE,aAAa,KAAK,IAAI,CAAC;AAE5F,aAAa;AACb,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,eAAe,CAAC,EAAE,sBAAsB,CAAC;IACzC,YAAY,CAAC,EAAE,cAAc,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,aAAa;AACb,wBAAgB,aAAa,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAwD1D"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.createTextBox = void 0;
|
|
8
|
+
/** @alpha */
|
|
9
|
+
function createTextBox(props) {
|
|
10
|
+
const div = document.createElement("div");
|
|
11
|
+
if (true === props.inline)
|
|
12
|
+
div.style.display = "inline";
|
|
13
|
+
let label;
|
|
14
|
+
if (undefined !== props.label) {
|
|
15
|
+
label = document.createElement("label");
|
|
16
|
+
label.innerText = props.label;
|
|
17
|
+
if (undefined !== props.id)
|
|
18
|
+
label.htmlFor = props.id;
|
|
19
|
+
div.appendChild(label);
|
|
20
|
+
}
|
|
21
|
+
const textbox = document.createElement("input");
|
|
22
|
+
textbox.type = "text";
|
|
23
|
+
if (undefined !== props.id)
|
|
24
|
+
textbox.id = props.id;
|
|
25
|
+
div.appendChild(textbox);
|
|
26
|
+
if (undefined !== props.parent)
|
|
27
|
+
props.parent.appendChild(div);
|
|
28
|
+
const handler = props.handler;
|
|
29
|
+
if (undefined !== handler) {
|
|
30
|
+
textbox.onchange = () => handler(textbox);
|
|
31
|
+
}
|
|
32
|
+
// Don't want the document's listeners intepreting keypresses as keyboard shortcuts...
|
|
33
|
+
const stopPropagation = (ev) => ev.stopPropagation();
|
|
34
|
+
textbox.onkeydown = textbox.onkeyup = stopPropagation;
|
|
35
|
+
const keypresshandler = props.keypresshandler;
|
|
36
|
+
if (undefined !== keypresshandler) {
|
|
37
|
+
textbox.onkeypress = (ev) => {
|
|
38
|
+
keypresshandler(textbox, ev);
|
|
39
|
+
ev.stopPropagation();
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
textbox.onkeypress = stopPropagation; // eslint-disable-line deprecation/deprecation
|
|
44
|
+
}
|
|
45
|
+
const focushandler = props.focushandler;
|
|
46
|
+
if (undefined !== focushandler) {
|
|
47
|
+
textbox.onfocus = () => focushandler(textbox);
|
|
48
|
+
}
|
|
49
|
+
if (undefined !== props.list) {
|
|
50
|
+
textbox.setAttribute("list", props.list);
|
|
51
|
+
}
|
|
52
|
+
if (undefined !== props.tooltip)
|
|
53
|
+
div.title = props.tooltip;
|
|
54
|
+
return { label, textbox, div };
|
|
55
|
+
}
|
|
56
|
+
exports.createTextBox = createTextBox;
|
|
57
|
+
//# sourceMappingURL=TextBox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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AAC,EAAE,CAAC,eAAe,EAAE,CAAC;IACpE,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,OAAO,GAAG,eAAe,CAAC;IACtD,MAAM,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;IAC9C,IAAI,SAAS,KAAK,eAAe,EAAE;QACjC,OAAO,CAAC,UAAU,GAAG,CAAC,EAAiB,EAAE,EAAE;YACzC,eAAe,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YAC7B,EAAE,CAAC,eAAe,EAAE,CAAC;QACvB,CAAC,CAAC;KACH;SAAM;QACL,OAAO,CAAC,UAAU,GAAG,eAAe,CAAC,CAAC,8CAA8C;KACrF;IAED,MAAM,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;IACxC,IAAI,SAAS,KAAK,YAAY,EAAE;QAC9B,OAAO,CAAC,OAAO,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;KAC/C;IAED,IAAI,SAAS,KAAK,KAAK,CAAC,IAAI,EAAE;QAC5B,OAAO,CAAC,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;KAC1C;IAED,IAAI,SAAS,KAAK,KAAK,CAAC,OAAO;QAC7B,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC;IAE5B,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;AACjC,CAAC;AAxDD,sCAwDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Controls\n */\n\n/** Wraps an HTML text input field.\n * @beta\n */\nexport interface TextBox {\n /** The label, if the text box has one. */\n label?: HTMLLabelElement;\n /** The text input element. */\n textbox: HTMLInputElement;\n /** The div containing the text box. */\n div: HTMLDivElement;\n}\n\n/** @alpha */\nexport type TextBoxHandler = (textbox: HTMLInputElement) => void;\n\n/** @alpha */\nexport type TextBoxKeyPressHandler = (textbox: HTMLInputElement, ev: KeyboardEvent) => void;\n\n/** @alpha */\nexport interface TextBoxProps {\n label?: string;\n id?: string;\n parent?: HTMLElement;\n handler?: TextBoxHandler;\n keypresshandler?: TextBoxKeyPressHandler;\n focushandler?: TextBoxHandler;\n tooltip?: string;\n inline?: boolean;\n list?: string; // if defined, contains the id of a datalist to bind to this textbox for autocompletion\n}\n\n/** @alpha */\nexport function createTextBox(props: TextBoxProps): TextBox {\n const div = document.createElement(\"div\");\n if (true === props.inline)\n div.style.display = \"inline\";\n\n let label;\n if (undefined !== props.label) {\n label = document.createElement(\"label\");\n label.innerText = props.label;\n if (undefined !== props.id)\n label.htmlFor = props.id;\n\n div.appendChild(label);\n }\n\n const textbox = document.createElement(\"input\");\n textbox.type = \"text\";\n if (undefined !== props.id)\n textbox.id = props.id;\n\n div.appendChild(textbox);\n\n if (undefined !== props.parent)\n props.parent.appendChild(div);\n\n const handler = props.handler;\n if (undefined !== handler) {\n textbox.onchange = () => handler(textbox);\n }\n\n // Don't want the document's listeners intepreting keypresses as keyboard shortcuts...\n const stopPropagation = (ev: KeyboardEvent) => ev.stopPropagation();\n textbox.onkeydown = textbox.onkeyup = stopPropagation;\n const keypresshandler = props.keypresshandler;\n if (undefined !== keypresshandler) {\n textbox.onkeypress = (ev: KeyboardEvent) => { // eslint-disable-line deprecation/deprecation\n keypresshandler(textbox, ev);\n ev.stopPropagation();\n };\n } else {\n textbox.onkeypress = stopPropagation; // eslint-disable-line deprecation/deprecation\n }\n\n const focushandler = props.focushandler;\n if (undefined !== focushandler) {\n textbox.onfocus = () => focushandler(textbox);\n }\n\n if (undefined !== props.list) {\n textbox.setAttribute(\"list\", props.list);\n }\n\n if (undefined !== props.tooltip)\n div.title = props.tooltip;\n\n return { label, textbox, div };\n}\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Viewport } from "@itwin/core-frontend";
|
|
2
|
+
import { KeyinField } from "./KeyinField";
|
|
3
|
+
/** Options for configuring a [[DiagnosticsPanel]].
|
|
4
|
+
* @beta
|
|
5
|
+
*/
|
|
6
|
+
export interface DiagnosticsPanelProps {
|
|
7
|
+
/** Widgets to exclude from the panel. */
|
|
8
|
+
exclude?: {
|
|
9
|
+
keyin?: boolean;
|
|
10
|
+
fps?: boolean;
|
|
11
|
+
tileStats?: boolean;
|
|
12
|
+
memory?: boolean;
|
|
13
|
+
tileMemoryBreakdown?: boolean;
|
|
14
|
+
gpuProfiler?: boolean;
|
|
15
|
+
toolSettings?: boolean;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/** Consolidates many other widgets into a single panel.
|
|
19
|
+
* @beta
|
|
20
|
+
*/
|
|
21
|
+
export declare class DiagnosticsPanel {
|
|
22
|
+
private readonly _element;
|
|
23
|
+
private readonly _parentElement?;
|
|
24
|
+
private readonly _fpsTracker?;
|
|
25
|
+
private readonly _memoryTracker?;
|
|
26
|
+
private readonly _tileMemoryBreakdown?;
|
|
27
|
+
private readonly _statsTracker?;
|
|
28
|
+
private readonly _gpuProfiler?;
|
|
29
|
+
private readonly _toolSettingsTracker?;
|
|
30
|
+
readonly keyinField?: KeyinField;
|
|
31
|
+
constructor(vp: Viewport, props?: DiagnosticsPanelProps);
|
|
32
|
+
get element(): HTMLElement;
|
|
33
|
+
dispose(): void;
|
|
34
|
+
private addSeparator;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=DiagnosticsPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DiagnosticsPanel.d.ts","sourceRoot":"","sources":["../../src/widgets/DiagnosticsPanel.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGhD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAM1C;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,yCAAyC;IACzC,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,GAAG,CAAC,EAAE,OAAO,CAAC;QACd,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,mBAAmB,CAAC,EAAE,OAAO,CAAC;QAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,YAAY,CAAC,EAAE,OAAO,CAAC;KACxB,CAAC;CACH;AAED;;GAEG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAc;IACvC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAc;IAC9C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAa;IAC1C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAgB;IAChD,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAsB;IAC5D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAwB;IACvD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAc;IAC5C,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAsB;IAC5D,SAAgB,UAAU,CAAC,EAAE,UAAU,CAAC;gBAErB,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,EAAE,qBAAqB;IA+C9D,IAAW,OAAO,IAAI,WAAW,CAA0B;IAEpD,OAAO,IAAI,IAAI;IAYtB,OAAO,CAAC,YAAY;CAGrB"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.DiagnosticsPanel = void 0;
|
|
8
|
+
/** @packageDocumentation
|
|
9
|
+
* @module Widgets
|
|
10
|
+
*/
|
|
11
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
12
|
+
const FpsTracker_1 = require("./FpsTracker");
|
|
13
|
+
const GpuProfiler_1 = require("./GpuProfiler");
|
|
14
|
+
const KeyinField_1 = require("./KeyinField");
|
|
15
|
+
const MemoryTracker_1 = require("./MemoryTracker");
|
|
16
|
+
const TileMemoryBreakdown_1 = require("./TileMemoryBreakdown");
|
|
17
|
+
const TileStatisticsTracker_1 = require("./TileStatisticsTracker");
|
|
18
|
+
const ToolSettingsTracker_1 = require("./ToolSettingsTracker");
|
|
19
|
+
/** Consolidates many other widgets into a single panel.
|
|
20
|
+
* @beta
|
|
21
|
+
*/
|
|
22
|
+
class DiagnosticsPanel {
|
|
23
|
+
constructor(vp, props) {
|
|
24
|
+
const exclude = (undefined !== props && undefined !== props.exclude) ? props.exclude : {};
|
|
25
|
+
this._element = document.createElement("div");
|
|
26
|
+
this._element.className = "debugPanel";
|
|
27
|
+
if (true !== exclude.fps) {
|
|
28
|
+
this._fpsTracker = new FpsTracker_1.FpsTracker(this._element, vp);
|
|
29
|
+
this.addSeparator();
|
|
30
|
+
}
|
|
31
|
+
if (true !== exclude.keyin) {
|
|
32
|
+
this.keyinField = new KeyinField_1.KeyinField({
|
|
33
|
+
parent: this._element,
|
|
34
|
+
baseId: "diagnosticsPanelKeyin",
|
|
35
|
+
wantButton: true,
|
|
36
|
+
wantLabel: true,
|
|
37
|
+
historyLength: 20,
|
|
38
|
+
});
|
|
39
|
+
this.addSeparator();
|
|
40
|
+
}
|
|
41
|
+
if (true !== exclude.tileStats) {
|
|
42
|
+
this._statsTracker = new TileStatisticsTracker_1.TileStatisticsTracker(this._element, vp);
|
|
43
|
+
this.addSeparator();
|
|
44
|
+
}
|
|
45
|
+
if (true !== exclude.tileMemoryBreakdown) {
|
|
46
|
+
this._tileMemoryBreakdown = new TileMemoryBreakdown_1.TileMemoryBreakdown(this._element);
|
|
47
|
+
this.addSeparator();
|
|
48
|
+
}
|
|
49
|
+
if (true !== exclude.memory) {
|
|
50
|
+
this._memoryTracker = new MemoryTracker_1.MemoryTracker(this._element, vp);
|
|
51
|
+
this.addSeparator();
|
|
52
|
+
}
|
|
53
|
+
if (true !== exclude.gpuProfiler) {
|
|
54
|
+
this._gpuProfiler = new GpuProfiler_1.GpuProfiler(this._element);
|
|
55
|
+
this.addSeparator();
|
|
56
|
+
}
|
|
57
|
+
if (true !== exclude.toolSettings)
|
|
58
|
+
this._toolSettingsTracker = new ToolSettingsTracker_1.ToolSettingsTracker(this._element, vp);
|
|
59
|
+
}
|
|
60
|
+
get element() { return this._element; }
|
|
61
|
+
dispose() {
|
|
62
|
+
(0, core_bentley_1.dispose)(this._fpsTracker);
|
|
63
|
+
(0, core_bentley_1.dispose)(this._memoryTracker);
|
|
64
|
+
(0, core_bentley_1.dispose)(this._tileMemoryBreakdown);
|
|
65
|
+
(0, core_bentley_1.dispose)(this._statsTracker);
|
|
66
|
+
(0, core_bentley_1.dispose)(this._gpuProfiler);
|
|
67
|
+
(0, core_bentley_1.dispose)(this._toolSettingsTracker);
|
|
68
|
+
if (undefined !== this._parentElement)
|
|
69
|
+
this._parentElement.removeChild(this._element);
|
|
70
|
+
}
|
|
71
|
+
addSeparator() {
|
|
72
|
+
this._element.appendChild(document.createElement("hr"));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.DiagnosticsPanel = DiagnosticsPanel;
|
|
76
|
+
//# sourceMappingURL=DiagnosticsPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DiagnosticsPanel.js","sourceRoot":"","sources":["../../src/widgets/DiagnosticsPanel.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,sDAA8C;AAE9C,6CAA0C;AAC1C,+CAA4C;AAC5C,6CAA0C;AAC1C,mDAAgD;AAChD,+DAA4D;AAC5D,mEAAgE;AAChE,+DAA4D;AAkB5D;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AM,EAAE;YAC3B,IAAI,CAAC,cAAc,GAAG,IAAI,6BAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YAC3D,IAAI,CAAC,YAAY,EAAE,CAAC;SACrB;QAED,IAAI,IAAI,KAAK,OAAO,CAAC,WAAW,EAAE;YAChC,IAAI,CAAC,YAAY,GAAG,IAAI,yBAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACnD,IAAI,CAAC,YAAY,EAAE,CAAC;SACrB;QAED,IAAI,IAAI,KAAK,OAAO,CAAC,YAAY;YAC/B,IAAI,CAAC,oBAAoB,GAAG,IAAI,yCAAmB,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAC3E,CAAC;IAED,IAAW,OAAO,KAAkB,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEpD,OAAO;QACZ,IAAA,sBAAO,EAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC1B,IAAA,sBAAO,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC7B,IAAA,sBAAO,EAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QACnC,IAAA,sBAAO,EAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC5B,IAAA,sBAAO,EAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC3B,IAAA,sBAAO,EAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAEnC,IAAI,SAAS,KAAK,IAAI,CAAC,cAAc;YACnC,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACnD,CAAC;IAEO,YAAY;QAClB,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAE,CAAC,CAAC;IAC3D,CAAC;CACF;AA3ED,4CA2EC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Widgets\n */\n\nimport { dispose } from \"@itwin/core-bentley\";\nimport { Viewport } from \"@itwin/core-frontend\";\nimport { FpsTracker } from \"./FpsTracker\";\nimport { GpuProfiler } from \"./GpuProfiler\";\nimport { KeyinField } from \"./KeyinField\";\nimport { MemoryTracker } from \"./MemoryTracker\";\nimport { TileMemoryBreakdown } from \"./TileMemoryBreakdown\";\nimport { TileStatisticsTracker } from \"./TileStatisticsTracker\";\nimport { ToolSettingsTracker } from \"./ToolSettingsTracker\";\n\n/** Options for configuring a [[DiagnosticsPanel]].\n * @beta\n */\nexport interface DiagnosticsPanelProps {\n /** Widgets to exclude from the panel. */\n exclude?: {\n keyin?: boolean;\n fps?: boolean;\n tileStats?: boolean;\n memory?: boolean;\n tileMemoryBreakdown?: boolean;\n gpuProfiler?: boolean;\n toolSettings?: boolean;\n };\n}\n\n/** Consolidates many other widgets into a single panel.\n * @beta\n */\nexport class DiagnosticsPanel {\n private readonly _element: HTMLElement;\n private readonly _parentElement?: HTMLElement;\n private readonly _fpsTracker?: FpsTracker;\n private readonly _memoryTracker?: MemoryTracker;\n private readonly _tileMemoryBreakdown?: TileMemoryBreakdown;\n private readonly _statsTracker?: TileStatisticsTracker;\n private readonly _gpuProfiler?: GpuProfiler;\n private readonly _toolSettingsTracker?: ToolSettingsTracker;\n public readonly keyinField?: KeyinField;\n\n public constructor(vp: Viewport, props?: DiagnosticsPanelProps) {\n const exclude = (undefined !== props && undefined !== props.exclude) ? props.exclude : {};\n\n this._element = document.createElement(\"div\");\n this._element.className = \"debugPanel\";\n\n if (true !== exclude.fps) {\n this._fpsTracker = new FpsTracker(this._element, vp);\n this.addSeparator();\n }\n\n if (true !== exclude.keyin) {\n this.keyinField = new KeyinField({\n parent: this._element,\n baseId: \"diagnosticsPanelKeyin\",\n wantButton: true,\n wantLabel: true,\n historyLength: 20,\n });\n\n this.addSeparator();\n }\n\n if (true !== exclude.tileStats) {\n this._statsTracker = new TileStatisticsTracker(this._element, vp);\n this.addSeparator();\n }\n\n if (true !== exclude.tileMemoryBreakdown) {\n this._tileMemoryBreakdown = new TileMemoryBreakdown(this._element);\n this.addSeparator();\n }\n\n if (true !== exclude.memory) {\n this._memoryTracker = new MemoryTracker(this._element, vp);\n this.addSeparator();\n }\n\n if (true !== exclude.gpuProfiler) {\n this._gpuProfiler = new GpuProfiler(this._element);\n this.addSeparator();\n }\n\n if (true !== exclude.toolSettings)\n this._toolSettingsTracker = new ToolSettingsTracker(this._element, vp);\n }\n\n public get element(): HTMLElement { return this._element; }\n\n public dispose(): void {\n dispose(this._fpsTracker);\n dispose(this._memoryTracker);\n dispose(this._tileMemoryBreakdown);\n dispose(this._statsTracker);\n dispose(this._gpuProfiler);\n dispose(this._toolSettingsTracker);\n\n if (undefined !== this._parentElement)\n this._parentElement.removeChild(this._element);\n }\n\n private addSeparator(): void {\n this._element.appendChild(document.createElement(\"hr\")!);\n }\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Widgets
|
|
3
|
+
*/
|
|
4
|
+
import { Viewport } from "@itwin/core-frontend";
|
|
5
|
+
/** Displays average frames-per-second.
|
|
6
|
+
* NOTE: Enabling fps tracking causes a new frame to render on every tick of the render loop, which may negatively impact battery life.
|
|
7
|
+
* @beta
|
|
8
|
+
*/
|
|
9
|
+
export declare class FpsTracker {
|
|
10
|
+
private readonly _label;
|
|
11
|
+
private _metrics?;
|
|
12
|
+
private _curIntervalId?;
|
|
13
|
+
private readonly _vp;
|
|
14
|
+
constructor(parent: HTMLElement, viewport: Viewport);
|
|
15
|
+
dispose(): void;
|
|
16
|
+
private clearInterval;
|
|
17
|
+
private toggle;
|
|
18
|
+
private updateFPS;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=FpsTracker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FpsTracker.d.ts","sourceRoot":"","sources":["../../src/widgets/FpsTracker.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAA8B,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAG5E;;;GAGG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmB;IAC1C,OAAO,CAAC,QAAQ,CAAC,CAAqB;IACtC,OAAO,CAAC,cAAc,CAAC,CAAe;IACtC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAW;gBAEZ,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ;IAUnD,OAAO,IAAI,IAAI;IAItB,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,MAAM;IAed,OAAO,CAAC,SAAS;CAKlB"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.FpsTracker = void 0;
|
|
8
|
+
/** @packageDocumentation
|
|
9
|
+
* @module Widgets
|
|
10
|
+
*/
|
|
11
|
+
const core_frontend_1 = require("@itwin/core-frontend");
|
|
12
|
+
const CheckBox_1 = require("../ui/CheckBox");
|
|
13
|
+
/** Displays average frames-per-second.
|
|
14
|
+
* NOTE: Enabling fps tracking causes a new frame to render on every tick of the render loop, which may negatively impact battery life.
|
|
15
|
+
* @beta
|
|
16
|
+
*/
|
|
17
|
+
class FpsTracker {
|
|
18
|
+
constructor(parent, viewport) {
|
|
19
|
+
this._vp = viewport;
|
|
20
|
+
this._label = (0, CheckBox_1.createCheckBox)({
|
|
21
|
+
parent,
|
|
22
|
+
name: "Track FPS",
|
|
23
|
+
id: "fpsTracker_toggle",
|
|
24
|
+
handler: (cb) => this.toggle(cb.checked),
|
|
25
|
+
}).label;
|
|
26
|
+
}
|
|
27
|
+
dispose() {
|
|
28
|
+
this.toggle(false);
|
|
29
|
+
}
|
|
30
|
+
clearInterval() {
|
|
31
|
+
if (undefined !== this._curIntervalId) {
|
|
32
|
+
clearInterval(this._curIntervalId);
|
|
33
|
+
this._curIntervalId = undefined;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
toggle(enabled) {
|
|
37
|
+
this._vp.continuousRendering = enabled;
|
|
38
|
+
if (enabled) {
|
|
39
|
+
this._metrics = new core_frontend_1.PerformanceMetrics(false, true);
|
|
40
|
+
this._curIntervalId = setInterval(() => this.updateFPS(), 500);
|
|
41
|
+
this._label.innerText = "Tracking FPS...";
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
this._metrics = undefined;
|
|
45
|
+
this.clearInterval();
|
|
46
|
+
this._label.innerText = "Track FPS";
|
|
47
|
+
}
|
|
48
|
+
this._vp.target.performanceMetrics = this._metrics;
|
|
49
|
+
}
|
|
50
|
+
updateFPS() {
|
|
51
|
+
const metrics = this._metrics;
|
|
52
|
+
const fps = (metrics.spfTimes.length / metrics.spfSum).toFixed(2);
|
|
53
|
+
this._label.innerText = `FPS: ${fps}`;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.FpsTracker = FpsTracker;
|
|
57
|
+
//# sourceMappingURL=FpsTracker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FpsTracker.js","sourceRoot":"","sources":["../../src/widgets/FpsTracker.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,wDAA4E;AAC5E,6CAAgD;AAEhD;;;GAGG;AACH,MAAa,UAAU;IAMrB,YAAmB,MAAmB,EAAE,QAAkB;QACxD,IAAI,CAAC,GAAG,GAAG,QAAQ,CAAC;QACpB,IAAI,CAAC,MAAM,GAAG,IAAA,yBAAc,EAAC;YA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IAAI,CAAC,MAAM,CAAC,SAAS,GAAG,QAAQ,GAAG,EAAE,CAAC;IACxC,CAAC;CACF;AA/CD,gCA+CC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Widgets\n */\n\nimport { PerformanceMetrics, Target, Viewport } from \"@itwin/core-frontend\";\nimport { createCheckBox } from \"../ui/CheckBox\";\n\n/** Displays average frames-per-second.\n * NOTE: Enabling fps tracking causes a new frame to render on every tick of the render loop, which may negatively impact battery life.\n * @beta\n */\nexport class FpsTracker {\n private readonly _label: HTMLLabelElement;\n private _metrics?: PerformanceMetrics;\n private _curIntervalId?: NodeJS.Timer;\n private readonly _vp: Viewport;\n\n public constructor(parent: HTMLElement, viewport: Viewport) {\n this._vp = viewport;\n this._label = createCheckBox({\n parent,\n name: \"Track FPS\",\n id: \"fpsTracker_toggle\",\n handler: (cb) => this.toggle(cb.checked),\n }).label;\n }\n\n public dispose(): void {\n this.toggle(false);\n }\n\n private clearInterval(): void {\n if (undefined !== this._curIntervalId) {\n clearInterval(this._curIntervalId);\n this._curIntervalId = undefined;\n }\n }\n\n private toggle(enabled: boolean): void {\n this._vp.continuousRendering = enabled;\n if (enabled) {\n this._metrics = new PerformanceMetrics(false, true);\n this._curIntervalId = setInterval(() => this.updateFPS(), 500);\n this._label.innerText = \"Tracking FPS...\";\n } else {\n this._metrics = undefined;\n this.clearInterval();\n this._label.innerText = \"Track FPS\";\n }\n\n (this._vp.target as Target).performanceMetrics = this._metrics;\n }\n\n private updateFPS(): void {\n const metrics = this._metrics!;\n const fps = (metrics.spfTimes.length / metrics.spfSum).toFixed(2);\n this._label.innerText = `FPS: ${fps}`;\n }\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** @alpha */
|
|
2
|
+
export declare class GpuProfiler {
|
|
3
|
+
private readonly _div;
|
|
4
|
+
private readonly _resultsDiv;
|
|
5
|
+
private readonly _results;
|
|
6
|
+
private readonly _debugControl;
|
|
7
|
+
private readonly _recordButton;
|
|
8
|
+
private _recordedResults;
|
|
9
|
+
private _isRecording;
|
|
10
|
+
constructor(parent: HTMLElement);
|
|
11
|
+
dispose(): void;
|
|
12
|
+
private toggleProfileCheckBox;
|
|
13
|
+
private _clickRecord;
|
|
14
|
+
private stopRecording;
|
|
15
|
+
private _resultsCallback;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=GpuProfiler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GpuProfiler.d.ts","sourceRoot":"","sources":["../../src/widgets/GpuProfiler.ts"],"names":[],"mappings":"AA2FA,aAAa;AACb,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAiB;IACtC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAiB;IAC7C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAuB;IAChD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA2B;IAEzD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAqB;IACnD,OAAO,CAAC,gBAAgB,CAAkB;IAC1C,OAAO,CAAC,YAAY,CAAU;gBAEX,MAAM,EAAE,WAAW;IAmC/B,OAAO,IAAI,IAAI;IAItB,OAAO,CAAC,qBAAqB;IAY7B,OAAO,CAAC,YAAY,CAQlB;IAEF,OAAO,CAAC,aAAa;IAYrB,OAAO,CAAC,gBAAgB,CA0EtB;CACH"}
|