@itwin/frontend-devtools 5.0.0-dev.32 → 5.0.0-dev.34

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.
Files changed (149) hide show
  1. package/lib/cjs/FrontEndDevTools.js +1 -1
  2. package/lib/cjs/FrontEndDevTools.js.map +1 -1
  3. package/lib/cjs/effects/Convolution.js +6 -6
  4. package/lib/cjs/effects/Convolution.js.map +1 -1
  5. package/lib/cjs/effects/EffectTools.js +2 -2
  6. package/lib/cjs/effects/EffectTools.js.map +1 -1
  7. package/lib/cjs/effects/Explosion.js +2 -2
  8. package/lib/cjs/effects/Explosion.js.map +1 -1
  9. package/lib/cjs/effects/FlipImage.js +2 -2
  10. package/lib/cjs/effects/FlipImage.js.map +1 -1
  11. package/lib/cjs/effects/LensDistortion.js +4 -4
  12. package/lib/cjs/effects/LensDistortion.js.map +1 -1
  13. package/lib/cjs/effects/Saturation.js +4 -4
  14. package/lib/cjs/effects/Saturation.js.map +1 -1
  15. package/lib/cjs/effects/Snow.js +2 -2
  16. package/lib/cjs/effects/Snow.js.map +1 -1
  17. package/lib/cjs/effects/Vignette.js +12 -12
  18. package/lib/cjs/effects/Vignette.js.map +1 -1
  19. package/lib/cjs/tools/AnimationIntervalTool.js +1 -1
  20. package/lib/cjs/tools/AnimationIntervalTool.js.map +1 -1
  21. package/lib/cjs/tools/ChangeUnitsTool.js +1 -1
  22. package/lib/cjs/tools/ChangeUnitsTool.js.map +1 -1
  23. package/lib/cjs/tools/ClipTools.js +4 -4
  24. package/lib/cjs/tools/ClipTools.js.map +1 -1
  25. package/lib/cjs/tools/DisplayStyleTools.js +10 -10
  26. package/lib/cjs/tools/DisplayStyleTools.js.map +1 -1
  27. package/lib/cjs/tools/EmphasizeElementsTool.js +5 -5
  28. package/lib/cjs/tools/EmphasizeElementsTool.js.map +1 -1
  29. package/lib/cjs/tools/FrustumDecoration.js +3 -3
  30. package/lib/cjs/tools/FrustumDecoration.js.map +1 -1
  31. package/lib/cjs/tools/InspectElementTool.js +1 -1
  32. package/lib/cjs/tools/InspectElementTool.js.map +1 -1
  33. package/lib/cjs/tools/MapLayerTool.js +20 -20
  34. package/lib/cjs/tools/MapLayerTool.js.map +1 -1
  35. package/lib/cjs/tools/MeasureTileLoadTime.js +1 -1
  36. package/lib/cjs/tools/MeasureTileLoadTime.js.map +1 -1
  37. package/lib/cjs/tools/ModelAppearanceTools.js +9 -9
  38. package/lib/cjs/tools/ModelAppearanceTools.js.map +1 -1
  39. package/lib/cjs/tools/PlanProjectionTools.js +3 -3
  40. package/lib/cjs/tools/PlanProjectionTools.js.map +1 -1
  41. package/lib/cjs/tools/PlanarMaskTools.js +12 -12
  42. package/lib/cjs/tools/PlanarMaskTools.js.map +1 -1
  43. package/lib/cjs/tools/ProjectExtents.js +1 -1
  44. package/lib/cjs/tools/ProjectExtents.js.map +1 -1
  45. package/lib/cjs/tools/RealityModelTools.js +10 -10
  46. package/lib/cjs/tools/RealityModelTools.js.map +1 -1
  47. package/lib/cjs/tools/RealityTransitionTool.js +1 -1
  48. package/lib/cjs/tools/RealityTransitionTool.js.map +1 -1
  49. package/lib/cjs/tools/RenderSystemTools.js +3 -3
  50. package/lib/cjs/tools/RenderSystemTools.js.map +1 -1
  51. package/lib/cjs/tools/RenderTargetTools.js +11 -11
  52. package/lib/cjs/tools/RenderTargetTools.js.map +1 -1
  53. package/lib/cjs/tools/ReportWebGLCompatibilityTool.js +1 -1
  54. package/lib/cjs/tools/ReportWebGLCompatibilityTool.js.map +1 -1
  55. package/lib/cjs/tools/SavedViews.js +3 -3
  56. package/lib/cjs/tools/SavedViews.js.map +1 -1
  57. package/lib/cjs/tools/ScheduleScriptTools.js +3 -3
  58. package/lib/cjs/tools/ScheduleScriptTools.js.map +1 -1
  59. package/lib/cjs/tools/SelectionTools.js +2 -2
  60. package/lib/cjs/tools/SelectionTools.js.map +1 -1
  61. package/lib/cjs/tools/SetGpuMemoryLimitTool.js +1 -1
  62. package/lib/cjs/tools/SetGpuMemoryLimitTool.js.map +1 -1
  63. package/lib/cjs/tools/SourceAspectIdTools.js +2 -2
  64. package/lib/cjs/tools/SourceAspectIdTools.js.map +1 -1
  65. package/lib/cjs/tools/TileRequestDecoration.js +1 -1
  66. package/lib/cjs/tools/TileRequestDecoration.js.map +1 -1
  67. package/lib/cjs/tools/TileTreeBoundsDecoration.js +1 -1
  68. package/lib/cjs/tools/TileTreeBoundsDecoration.js.map +1 -1
  69. package/lib/cjs/tools/ToolTipProvider.js +1 -1
  70. package/lib/cjs/tools/ToolTipProvider.js.map +1 -1
  71. package/lib/cjs/tools/ViewportTools.js +19 -19
  72. package/lib/cjs/tools/ViewportTools.js.map +1 -1
  73. package/lib/cjs/widgets/ToolSettingsTracker.js +1 -1
  74. package/lib/cjs/widgets/ToolSettingsTracker.js.map +1 -1
  75. package/lib/esm/FrontEndDevTools.js +1 -1
  76. package/lib/esm/FrontEndDevTools.js.map +1 -1
  77. package/lib/esm/effects/Convolution.js +6 -6
  78. package/lib/esm/effects/Convolution.js.map +1 -1
  79. package/lib/esm/effects/EffectTools.js +2 -2
  80. package/lib/esm/effects/EffectTools.js.map +1 -1
  81. package/lib/esm/effects/Explosion.js +2 -2
  82. package/lib/esm/effects/Explosion.js.map +1 -1
  83. package/lib/esm/effects/FlipImage.js +2 -2
  84. package/lib/esm/effects/FlipImage.js.map +1 -1
  85. package/lib/esm/effects/LensDistortion.js +4 -4
  86. package/lib/esm/effects/LensDistortion.js.map +1 -1
  87. package/lib/esm/effects/Saturation.js +4 -4
  88. package/lib/esm/effects/Saturation.js.map +1 -1
  89. package/lib/esm/effects/Snow.js +2 -2
  90. package/lib/esm/effects/Snow.js.map +1 -1
  91. package/lib/esm/effects/Vignette.js +12 -12
  92. package/lib/esm/effects/Vignette.js.map +1 -1
  93. package/lib/esm/tools/AnimationIntervalTool.js +1 -1
  94. package/lib/esm/tools/AnimationIntervalTool.js.map +1 -1
  95. package/lib/esm/tools/ChangeUnitsTool.js +1 -1
  96. package/lib/esm/tools/ChangeUnitsTool.js.map +1 -1
  97. package/lib/esm/tools/ClipTools.js +4 -4
  98. package/lib/esm/tools/ClipTools.js.map +1 -1
  99. package/lib/esm/tools/DisplayStyleTools.js +10 -10
  100. package/lib/esm/tools/DisplayStyleTools.js.map +1 -1
  101. package/lib/esm/tools/EmphasizeElementsTool.js +5 -5
  102. package/lib/esm/tools/EmphasizeElementsTool.js.map +1 -1
  103. package/lib/esm/tools/FrustumDecoration.js +3 -3
  104. package/lib/esm/tools/FrustumDecoration.js.map +1 -1
  105. package/lib/esm/tools/InspectElementTool.js +1 -1
  106. package/lib/esm/tools/InspectElementTool.js.map +1 -1
  107. package/lib/esm/tools/MapLayerTool.js +20 -20
  108. package/lib/esm/tools/MapLayerTool.js.map +1 -1
  109. package/lib/esm/tools/MeasureTileLoadTime.js +1 -1
  110. package/lib/esm/tools/MeasureTileLoadTime.js.map +1 -1
  111. package/lib/esm/tools/ModelAppearanceTools.js +9 -9
  112. package/lib/esm/tools/ModelAppearanceTools.js.map +1 -1
  113. package/lib/esm/tools/PlanProjectionTools.js +3 -3
  114. package/lib/esm/tools/PlanProjectionTools.js.map +1 -1
  115. package/lib/esm/tools/PlanarMaskTools.js +12 -12
  116. package/lib/esm/tools/PlanarMaskTools.js.map +1 -1
  117. package/lib/esm/tools/ProjectExtents.js +1 -1
  118. package/lib/esm/tools/ProjectExtents.js.map +1 -1
  119. package/lib/esm/tools/RealityModelTools.js +10 -10
  120. package/lib/esm/tools/RealityModelTools.js.map +1 -1
  121. package/lib/esm/tools/RealityTransitionTool.js +1 -1
  122. package/lib/esm/tools/RealityTransitionTool.js.map +1 -1
  123. package/lib/esm/tools/RenderSystemTools.js +3 -3
  124. package/lib/esm/tools/RenderSystemTools.js.map +1 -1
  125. package/lib/esm/tools/RenderTargetTools.js +11 -11
  126. package/lib/esm/tools/RenderTargetTools.js.map +1 -1
  127. package/lib/esm/tools/ReportWebGLCompatibilityTool.js +1 -1
  128. package/lib/esm/tools/ReportWebGLCompatibilityTool.js.map +1 -1
  129. package/lib/esm/tools/SavedViews.js +3 -3
  130. package/lib/esm/tools/SavedViews.js.map +1 -1
  131. package/lib/esm/tools/ScheduleScriptTools.js +3 -3
  132. package/lib/esm/tools/ScheduleScriptTools.js.map +1 -1
  133. package/lib/esm/tools/SelectionTools.js +2 -2
  134. package/lib/esm/tools/SelectionTools.js.map +1 -1
  135. package/lib/esm/tools/SetGpuMemoryLimitTool.js +1 -1
  136. package/lib/esm/tools/SetGpuMemoryLimitTool.js.map +1 -1
  137. package/lib/esm/tools/SourceAspectIdTools.js +2 -2
  138. package/lib/esm/tools/SourceAspectIdTools.js.map +1 -1
  139. package/lib/esm/tools/TileRequestDecoration.js +1 -1
  140. package/lib/esm/tools/TileRequestDecoration.js.map +1 -1
  141. package/lib/esm/tools/TileTreeBoundsDecoration.js +1 -1
  142. package/lib/esm/tools/TileTreeBoundsDecoration.js.map +1 -1
  143. package/lib/esm/tools/ToolTipProvider.js +1 -1
  144. package/lib/esm/tools/ToolTipProvider.js.map +1 -1
  145. package/lib/esm/tools/ViewportTools.js +19 -19
  146. package/lib/esm/tools/ViewportTools.js.map +1 -1
  147. package/lib/esm/widgets/ToolSettingsTracker.js +1 -1
  148. package/lib/esm/widgets/ToolSettingsTracker.js.map +1 -1
  149. package/package.json +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"Snow.js","sourceRoot":"","sources":["../../../src/effects/Snow.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA8C;AAC9C,wDAA2E;AAC3E,oDAAwE;AACxE,wDAE8B;AAC9B,sDAAmD;AACnD,qCAAsD;AAkCtD,+EAA+E;AAC/E,MAAM,iBAAiB,GAAe;IACpC,YAAY,EAAE,IAAI;IAClB,SAAS,EAAE,uBAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC;IAClC,iBAAiB,EAAE,uBAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,EA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MAAM,MAAM,GAAG,IAAA,yBAAW,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACpC,IAAI,OAAO,MAAM,KAAK,QAAQ;YAC5B,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAEzB,OAAO,IAAI,CAAC;IACd,CAAC;;AAjBH,gCAkBC;AAjBwB,iBAAM,GAAG,YAAY,CAAC","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/** @packageDocumentation\n * @module Effects\n */\n\nimport { dispose } from \"@itwin/core-bentley\";\nimport { Point2d, Range1d, Range2d, Vector2d } from \"@itwin/core-geometry\";\nimport { RenderTexture, TextureTransparency } from \"@itwin/core-common\";\nimport {\n DecorateContext, Decorator, GraphicType, imageElementFromUrl, IModelApp, ParticleCollectionBuilder, ParticleProps, Tool, Viewport,\n} from \"@itwin/core-frontend\";\nimport { parseToggle } from \"../tools/parseToggle\";\nimport { randomFloat, randomInteger } from \"./Random\";\n\n/** Represents one particle displayed by a [[SnowDecorator]].\n * Particle positions are in [CoordSystem.View]($frontend).\n * @beta\n */\nexport interface SnowParticle extends ParticleProps {\n /** Make x, y, and z from ParticleProps writable. */\n x: number;\n y: number;\n z: number;\n\n /** Current velocity, in pixels per second. */\n velocity: Vector2d;\n}\n\n/** Parameters controlling how a [[SnowDecorator]] works.\n * @beta\n */\nexport interface SnowParams {\n /** The number of snow particles to produce. This could alternatively be expressed as a density so that small viewports would not be more crowded than larger ones. */\n numParticles: number;\n /** Range from which to randomly select each particle's size, in pixels. */\n sizeRange: Range1d;\n /** Range from which to randomly select each particle's transparency. */\n transparencyRange: Range1d;\n /** Range from which to randomly select each particle's initial velocity, in pixels per second. */\n velocityRange: Range2d;\n /** Range from which to randomly select an acceleration to apply to each particle's velocity each frame, in pixels per second squared, to simulate wind. */\n accelerationRange: Range2d;\n /** Wind velocity in pixels per second in X. */\n windVelocity: number;\n}\n\n/** The default snow effect parameters used by newly-created SnowDecorators. */\nconst defaultSnowParams: SnowParams = {\n numParticles: 2000,\n sizeRange: Range1d.createXX(3, 22),\n transparencyRange: Range1d.createXX(0, 50),\n velocityRange: new Range2d(-30, 50, 30, 130),\n accelerationRange: new Range2d(-1, -0.25, 1, 0.25),\n windVelocity: 0,\n};\n\n/** Simulates snowfall in a [Viewport]($frontend) using particle effects.\n * @see [[SnowEffect]] for a [Tool]($frontend) that toggles this decorator.\n * @see [ParticleCollectionBuilder]($frontend) for defining custom particle effects.\n * @beta\n */\nexport class SnowDecorator implements Decorator {\n /** The viewport being decorated. */\n public readonly viewport: Viewport;\n /** Invoked when this decorator is to be destroyed. */\n public readonly dispose: VoidFunction;\n /** The initial width and height of the viewport, from which we randomly select each particle's initial position. */\n private readonly _dimensions: Point2d;\n /** The list of particles being drawn. */\n private readonly _particles: SnowParticle[] = [];\n /** The image to display for each particle. */\n private _texture?: RenderTexture;\n /** The last time `updateParticles()` was invoked, in milliseconds. */\n private _lastUpdateTime: number;\n private readonly _params: SnowParams;\n\n private constructor(viewport: Viewport, texture: RenderTexture | undefined) {\n this._params = { ...defaultSnowParams };\n this.viewport = viewport;\n this._dimensions = new Point2d(viewport.viewRect.width, viewport.viewRect.height);\n this._lastUpdateTime = Date.now();\n this._texture = texture;\n\n // Tell the viewport to re-render the decorations every frame so that the snow particles animate smoothly.\n const removeOnRender = viewport.onRender.addListener(() => viewport.invalidateDecorations());\n\n // When the viewport is resized, replace this decorator with a new one to match the new dimensions.\n const removeOnResized = viewport.onResized.addListener(() => {\n // Transfer ownership of the texture to the new decorator.\n const tex = this._texture;\n this._texture = undefined;\n this.dispose();\n new SnowDecorator(viewport, tex);\n });\n\n // When the viewport is destroyed, dispose of this decorator too.\n const removeOnDispose = viewport.onDisposed.addListener(() => this.dispose());\n const removeDecorator = IModelApp.viewManager.addDecorator(this);\n\n this.dispose = () => {\n removeDecorator();\n removeOnRender();\n removeOnDispose();\n removeOnResized();\n this._texture = dispose(this._texture);\n SnowDecorator._decorators.delete(viewport);\n };\n\n SnowDecorator._decorators.set(viewport, this);\n\n // Initialize the particles.\n for (let i = 0; i < this._params.numParticles; i++)\n this._particles.push(this.emit(true));\n }\n\n public decorate(context: DecorateContext): void {\n if (context.viewport !== this.viewport || !this._texture)\n return;\n\n // Update the particles.\n const now = Date.now();\n const deltaMillis = now - this._lastUpdateTime;\n this._lastUpdateTime = now;\n this.updateParticles(deltaMillis / 1000);\n\n // Create particle graphics.\n const builder = ParticleCollectionBuilder.create({\n viewport: this.viewport,\n isViewCoords: true,\n texture: this._texture,\n size: (this._params.sizeRange.high - this._params.sizeRange.low) / 2,\n });\n\n for (const particle of this._particles)\n builder.addParticle(particle);\n\n const graphic = builder.finish();\n if (graphic)\n context.addDecoration(GraphicType.ViewOverlay, graphic);\n }\n\n /** Change some of the parameters affecting this decorator. */\n public configure(params: Partial<SnowParams>): void {\n for (const key of Object.keys(params)) {\n const val = (params as any)[key];\n if (undefined !== val)\n (this._params as any)[key] = val;\n }\n }\n\n /** Emit a new particle with randomized properties. */\n private emit(randomizeHeight: boolean): SnowParticle {\n return {\n x: randomInteger(0, this._dimensions.x),\n y: randomizeHeight ? randomInteger(0, this._dimensions.y) : 0,\n z: 0,\n size: randomInteger(this._params.sizeRange.low, this._params.sizeRange.high),\n transparency: randomInteger(this._params.transparencyRange.low, this._params.transparencyRange.high),\n velocity: new Vector2d(randomFloat(this._params.velocityRange.low.x, this._params.velocityRange.high.x),\n randomFloat(this._params.velocityRange.low.y, this._params.velocityRange.high.y)),\n };\n }\n\n // Update the positions and velocities of all the particles based on the amount of time that has passed since the last update.\n private updateParticles(elapsedSeconds: number): void {\n // Determine if someone changed the desired number of particles.\n const particleDiscrepancy = this._params.numParticles - this._particles.length;\n if (particleDiscrepancy > 0) {\n // Birth new particles up to the new maximum.\n for (let i = 0; i < particleDiscrepancy; i++)\n this._particles.push(this.emit(true));\n } else {\n // Destroy extra particles.\n this._particles.length = this._params.numParticles;\n }\n\n const acceleration = new Vector2d();\n const velocity = new Vector2d();\n for (let i = 0; i < this._particles.length; i++) {\n // Apply some acceleration to produce random drift.\n const particle = this._particles[i];\n acceleration.set(randomFloat(this._params.accelerationRange.low.x, this._params.accelerationRange.high.x),\n randomFloat(this._params.accelerationRange.low.y, this._params.accelerationRange.high.y));\n\n acceleration.scale(elapsedSeconds, acceleration);\n particle.velocity.plus(acceleration, particle.velocity);\n\n // Apply velocity.\n particle.velocity.clone(velocity);\n velocity.scale(elapsedSeconds, velocity);\n particle.x += velocity.x;\n particle.y += velocity.y;\n\n // Apply wind\n particle.x += this._params.windVelocity * elapsedSeconds;\n\n // Particles that travel beyond the viewport's left or right edges wrap around to the other side.\n if (particle.x < 0)\n particle.x = this._dimensions.x - 1;\n else if (particle.x >= this._dimensions.x)\n particle.x = 0;\n\n // Particles that travel beyond the viewport's bottom or top edges are replaced by newborn particles.\n if (particle.y < 0 || particle.y >= this._dimensions.y)\n this._particles[i] = this.emit(false);\n }\n }\n\n private static readonly _decorators = new Map<Viewport, SnowDecorator>();\n\n /** Toggle this decorator for the specified viewport.\n * @param viewport The viewport to which the effect should be applied or removed.\n * @param enable `true` to enable the effect, `false` to disable it, or `undefined` to toggle the current state.\n */\n public static async toggle(viewport: Viewport, enable?: boolean): Promise<void> {\n const decorator = this._decorators.get(viewport);\n if (undefined === enable)\n enable = undefined === decorator;\n\n if (undefined !== decorator && !enable)\n decorator.dispose();\n else if (undefined === decorator && enable) {\n // Create a texture to use for the particles.\n // Note: the decorator takes ownership of the texture, and disposes of it when the decorator is disposed.\n const image = await imageElementFromUrl(`${IModelApp.publicPath}sprites/particle_snow.png`);\n const texture = IModelApp.renderSystem.createTexture({\n ownership: \"external\",\n image: { source: image, transparency: TextureTransparency.Mixed },\n });\n\n new SnowDecorator(viewport, texture);\n }\n }\n}\n\n/** Toggles a decorator that simulates snow using particle effects.\n * @see [[SnowDecorator]] for the implementation of the decorator.\n * @beta\n */\nexport class SnowEffect extends Tool {\n public static override toolId = \"SnowEffect\";\n\n public override async run(enable?: boolean): Promise<boolean> {\n const vp = IModelApp.viewManager.selectedView;\n if (vp)\n await SnowDecorator.toggle(vp, enable);\n\n return true;\n }\n\n public override async parseAndRun(...args: string[]): Promise<boolean> {\n const enable = parseToggle(args[0]);\n if (typeof enable !== \"string\")\n await this.run(enable);\n\n return true;\n }\n}\n"]}
1
+ {"version":3,"file":"Snow.js","sourceRoot":"","sources":["../../../src/effects/Snow.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA8C;AAC9C,wDAA2E;AAC3E,oDAAwE;AACxE,wDAE8B;AAC9B,sDAAmD;AACnD,qCAAsD;AAkCtD,+EAA+E;AAC/E,MAAM,iBAAiB,GAAe;IACpC,YAAY,EAAE,IAAI;IAClB,SAAS,EAAE,uBAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC;IAClC,iBAAiB,EAAE,uBAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC;IAC1C,aAAa,EAAE,IAAI,uBAAO,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC;IAC5C,iBAAiB,EAAE,IAAI,uBAAO,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC;IAClD,YAAY,EAAE,CAAC;CAChB,CAAC;AAEF;;;;GAIG;AACH,MAAa,aAAa;IAexB,YAAoB,QAAkB,EAAE,OAAkC;QAR1E,yCAAyC;QACxB,eAAU,GAAmB,EAAE,CAAC;QAQ/C,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,iBAAiB,EAAE,CAAC;QACxC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,IAAI,uBAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,QAA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,mCAAmB,EAAC,GAAG,yBAAS,CAAC,UAAU,2BAA2B,CAAC,CAAC;YAC5F,MAAM,OAAO,GAAG,yBAAS,CAAC,YAAY,CAAC,aAAa,CAAC;gBACnD,SAAS,EAAE,UAAU;gBACrB,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,iCAAmB,CAAC,KAAK,EAAE;aAClE,CAAC,CAAC;YAEH,IAAI,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;;AA3KH,sCA4KC;AAED;;;GAGG;AACH,MAAa,UAAW,SAAQ,oBAAI;aACX,WAAM,GAAG,YAAY,CAAC;IAE7B,KAAK,CAAC,GAAG,CAAC,MAAgB;QACxC,MAAM,EAAE,GAAG,yBAAS,CAAC,WAAW,CAAC,YAAY,CAAC;QAC9C,IAAI,EAAE;YACJ,MAAM,aAAa,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;QAEzC,OAAO,IAAI,CAAC;IACd,CAAC;IAEe,KAAK,CAAC,WAAW,CAAC,GAAG,IAAc;QACjD,MAAM,MAAM,GAAG,IAAA,yBAAW,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACpC,IAAI,OAAO,MAAM,KAAK,QAAQ;YAC5B,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAEzB,OAAO,IAAI,CAAC;IACd,CAAC;;AAjBH,gCAkBC","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/** @packageDocumentation\n * @module Effects\n */\n\nimport { dispose } from \"@itwin/core-bentley\";\nimport { Point2d, Range1d, Range2d, Vector2d } from \"@itwin/core-geometry\";\nimport { RenderTexture, TextureTransparency } from \"@itwin/core-common\";\nimport {\n DecorateContext, Decorator, GraphicType, imageElementFromUrl, IModelApp, ParticleCollectionBuilder, ParticleProps, Tool, Viewport,\n} from \"@itwin/core-frontend\";\nimport { parseToggle } from \"../tools/parseToggle\";\nimport { randomFloat, randomInteger } from \"./Random\";\n\n/** Represents one particle displayed by a [[SnowDecorator]].\n * Particle positions are in [CoordSystem.View]($frontend).\n * @beta\n */\nexport interface SnowParticle extends ParticleProps {\n /** Make x, y, and z from ParticleProps writable. */\n x: number;\n y: number;\n z: number;\n\n /** Current velocity, in pixels per second. */\n velocity: Vector2d;\n}\n\n/** Parameters controlling how a [[SnowDecorator]] works.\n * @beta\n */\nexport interface SnowParams {\n /** The number of snow particles to produce. This could alternatively be expressed as a density so that small viewports would not be more crowded than larger ones. */\n numParticles: number;\n /** Range from which to randomly select each particle's size, in pixels. */\n sizeRange: Range1d;\n /** Range from which to randomly select each particle's transparency. */\n transparencyRange: Range1d;\n /** Range from which to randomly select each particle's initial velocity, in pixels per second. */\n velocityRange: Range2d;\n /** Range from which to randomly select an acceleration to apply to each particle's velocity each frame, in pixels per second squared, to simulate wind. */\n accelerationRange: Range2d;\n /** Wind velocity in pixels per second in X. */\n windVelocity: number;\n}\n\n/** The default snow effect parameters used by newly-created SnowDecorators. */\nconst defaultSnowParams: SnowParams = {\n numParticles: 2000,\n sizeRange: Range1d.createXX(3, 22),\n transparencyRange: Range1d.createXX(0, 50),\n velocityRange: new Range2d(-30, 50, 30, 130),\n accelerationRange: new Range2d(-1, -0.25, 1, 0.25),\n windVelocity: 0,\n};\n\n/** Simulates snowfall in a [Viewport]($frontend) using particle effects.\n * @see [[SnowEffect]] for a [Tool]($frontend) that toggles this decorator.\n * @see [ParticleCollectionBuilder]($frontend) for defining custom particle effects.\n * @beta\n */\nexport class SnowDecorator implements Decorator {\n /** The viewport being decorated. */\n public readonly viewport: Viewport;\n /** Invoked when this decorator is to be destroyed. */\n public readonly dispose: VoidFunction;\n /** The initial width and height of the viewport, from which we randomly select each particle's initial position. */\n private readonly _dimensions: Point2d;\n /** The list of particles being drawn. */\n private readonly _particles: SnowParticle[] = [];\n /** The image to display for each particle. */\n private _texture?: RenderTexture;\n /** The last time `updateParticles()` was invoked, in milliseconds. */\n private _lastUpdateTime: number;\n private readonly _params: SnowParams;\n\n private constructor(viewport: Viewport, texture: RenderTexture | undefined) {\n this._params = { ...defaultSnowParams };\n this.viewport = viewport;\n this._dimensions = new Point2d(viewport.viewRect.width, viewport.viewRect.height);\n this._lastUpdateTime = Date.now();\n this._texture = texture;\n\n // Tell the viewport to re-render the decorations every frame so that the snow particles animate smoothly.\n const removeOnRender = viewport.onRender.addListener(() => viewport.invalidateDecorations());\n\n // When the viewport is resized, replace this decorator with a new one to match the new dimensions.\n const removeOnResized = viewport.onResized.addListener(() => {\n // Transfer ownership of the texture to the new decorator.\n const tex = this._texture;\n this._texture = undefined;\n this.dispose();\n new SnowDecorator(viewport, tex);\n });\n\n // When the viewport is destroyed, dispose of this decorator too.\n const removeOnDispose = viewport.onDisposed.addListener(() => this.dispose());\n const removeDecorator = IModelApp.viewManager.addDecorator(this);\n\n this.dispose = () => {\n removeDecorator();\n removeOnRender();\n removeOnDispose();\n removeOnResized();\n this._texture = dispose(this._texture);\n SnowDecorator._decorators.delete(viewport);\n };\n\n SnowDecorator._decorators.set(viewport, this);\n\n // Initialize the particles.\n for (let i = 0; i < this._params.numParticles; i++)\n this._particles.push(this.emit(true));\n }\n\n public decorate(context: DecorateContext): void {\n if (context.viewport !== this.viewport || !this._texture)\n return;\n\n // Update the particles.\n const now = Date.now();\n const deltaMillis = now - this._lastUpdateTime;\n this._lastUpdateTime = now;\n this.updateParticles(deltaMillis / 1000);\n\n // Create particle graphics.\n const builder = ParticleCollectionBuilder.create({\n viewport: this.viewport,\n isViewCoords: true,\n texture: this._texture,\n size: (this._params.sizeRange.high - this._params.sizeRange.low) / 2,\n });\n\n for (const particle of this._particles)\n builder.addParticle(particle);\n\n const graphic = builder.finish();\n if (graphic)\n context.addDecoration(GraphicType.ViewOverlay, graphic);\n }\n\n /** Change some of the parameters affecting this decorator. */\n public configure(params: Partial<SnowParams>): void {\n for (const key of Object.keys(params)) {\n const val = (params as any)[key];\n if (undefined !== val)\n (this._params as any)[key] = val;\n }\n }\n\n /** Emit a new particle with randomized properties. */\n private emit(randomizeHeight: boolean): SnowParticle {\n return {\n x: randomInteger(0, this._dimensions.x),\n y: randomizeHeight ? randomInteger(0, this._dimensions.y) : 0,\n z: 0,\n size: randomInteger(this._params.sizeRange.low, this._params.sizeRange.high),\n transparency: randomInteger(this._params.transparencyRange.low, this._params.transparencyRange.high),\n velocity: new Vector2d(randomFloat(this._params.velocityRange.low.x, this._params.velocityRange.high.x),\n randomFloat(this._params.velocityRange.low.y, this._params.velocityRange.high.y)),\n };\n }\n\n // Update the positions and velocities of all the particles based on the amount of time that has passed since the last update.\n private updateParticles(elapsedSeconds: number): void {\n // Determine if someone changed the desired number of particles.\n const particleDiscrepancy = this._params.numParticles - this._particles.length;\n if (particleDiscrepancy > 0) {\n // Birth new particles up to the new maximum.\n for (let i = 0; i < particleDiscrepancy; i++)\n this._particles.push(this.emit(true));\n } else {\n // Destroy extra particles.\n this._particles.length = this._params.numParticles;\n }\n\n const acceleration = new Vector2d();\n const velocity = new Vector2d();\n for (let i = 0; i < this._particles.length; i++) {\n // Apply some acceleration to produce random drift.\n const particle = this._particles[i];\n acceleration.set(randomFloat(this._params.accelerationRange.low.x, this._params.accelerationRange.high.x),\n randomFloat(this._params.accelerationRange.low.y, this._params.accelerationRange.high.y));\n\n acceleration.scale(elapsedSeconds, acceleration);\n particle.velocity.plus(acceleration, particle.velocity);\n\n // Apply velocity.\n particle.velocity.clone(velocity);\n velocity.scale(elapsedSeconds, velocity);\n particle.x += velocity.x;\n particle.y += velocity.y;\n\n // Apply wind\n particle.x += this._params.windVelocity * elapsedSeconds;\n\n // Particles that travel beyond the viewport's left or right edges wrap around to the other side.\n if (particle.x < 0)\n particle.x = this._dimensions.x - 1;\n else if (particle.x >= this._dimensions.x)\n particle.x = 0;\n\n // Particles that travel beyond the viewport's bottom or top edges are replaced by newborn particles.\n if (particle.y < 0 || particle.y >= this._dimensions.y)\n this._particles[i] = this.emit(false);\n }\n }\n\n private static readonly _decorators = new Map<Viewport, SnowDecorator>();\n\n /** Toggle this decorator for the specified viewport.\n * @param viewport The viewport to which the effect should be applied or removed.\n * @param enable `true` to enable the effect, `false` to disable it, or `undefined` to toggle the current state.\n */\n public static async toggle(viewport: Viewport, enable?: boolean): Promise<void> {\n const decorator = this._decorators.get(viewport);\n if (undefined === enable)\n enable = undefined === decorator;\n\n if (undefined !== decorator && !enable)\n decorator.dispose();\n else if (undefined === decorator && enable) {\n // Create a texture to use for the particles.\n // Note: the decorator takes ownership of the texture, and disposes of it when the decorator is disposed.\n const image = await imageElementFromUrl(`${IModelApp.publicPath}sprites/particle_snow.png`);\n const texture = IModelApp.renderSystem.createTexture({\n ownership: \"external\",\n image: { source: image, transparency: TextureTransparency.Mixed },\n });\n\n new SnowDecorator(viewport, texture);\n }\n }\n}\n\n/** Toggles a decorator that simulates snow using particle effects.\n * @see [[SnowDecorator]] for the implementation of the decorator.\n * @beta\n */\nexport class SnowEffect extends Tool {\n public static override toolId = \"SnowEffect\";\n\n public override async run(enable?: boolean): Promise<boolean> {\n const vp = IModelApp.viewManager.selectedView;\n if (vp)\n await SnowDecorator.toggle(vp, enable);\n\n return true;\n }\n\n public override async parseAndRun(...args: string[]): Promise<boolean> {\n const enable = parseToggle(args[0]);\n if (typeof enable !== \"string\")\n await this.run(enable);\n\n return true;\n }\n}\n"]}
@@ -16,6 +16,7 @@ const EffectTools_1 = require("./EffectTools");
16
16
  * @beta
17
17
  */
18
18
  class VignetteEffect extends EffectTools_1.AddEffectTool {
19
+ static { this.toolId = "VignetteEffect"; }
19
20
  get effectName() { return "Vignette"; }
20
21
  get textureCoordFromPosition() { return true; }
21
22
  get source() {
@@ -73,13 +74,23 @@ class VignetteEffect extends EffectTools_1.AddEffectTool {
73
74
  }
74
75
  }
75
76
  exports.VignetteEffect = VignetteEffect;
76
- VignetteEffect.toolId = "VignetteEffect";
77
77
  /** Configures the [[VignetteEffect]].
78
78
  * @beta
79
79
  */
80
80
  class VignetteConfig extends core_frontend_1.Tool {
81
+ static { this.toolId = "VignetteConfig"; }
81
82
  static get minArgs() { return 0; }
82
83
  static get maxArgs() { return 4; }
84
+ /** Size of the vignette in the form (width/2, height/2). e.g., to make the vignette start fading in halfway between the center and edges of
85
+ * UV space, use (0.25, 0.25).
86
+ */
87
+ static { this.size = new Float32Array([0.25, 0.25]); }
88
+ /** How round the vignette will be, from 0.0 (perfectly rectangular) to 1.0 (perfectly round). */
89
+ static { this.roundness = 1.0; }
90
+ /** How quickly the vignette fades in. The vignette starts fading in at the edge of the values provided by `size` and will be
91
+ * fully faded in at (size.x + smoothness, size.y * smoothness). A value of 0.0 produces a hard edge.
92
+ */
93
+ static { this.smoothness = 0.5; }
83
94
  async run(width, height, roundness, smoothness) {
84
95
  const config = VignetteConfig;
85
96
  config.size[0] = width ?? config.size[0];
@@ -95,15 +106,4 @@ class VignetteConfig extends core_frontend_1.Tool {
95
106
  }
96
107
  }
97
108
  exports.VignetteConfig = VignetteConfig;
98
- VignetteConfig.toolId = "VignetteConfig";
99
- /** Size of the vignette in the form (width/2, height/2). e.g., to make the vignette start fading in halfway between the center and edges of
100
- * UV space, use (0.25, 0.25).
101
- */
102
- VignetteConfig.size = new Float32Array([0.25, 0.25]);
103
- /** How round the vignette will be, from 0.0 (perfectly rectangular) to 1.0 (perfectly round). */
104
- VignetteConfig.roundness = 1.0;
105
- /** How quickly the vignette fades in. The vignette starts fading in at the edge of the values provided by `size` and will be
106
- * fully faded in at (size.x + smoothness, size.y * smoothness). A value of 0.0 produces a hard edge.
107
- */
108
- VignetteConfig.smoothness = 0.5;
109
109
  //# sourceMappingURL=Vignette.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Vignette.js","sourceRoot":"","sources":["../../../src/effects/Vignette.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,wD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c,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAelC,KAAK,CAAC,GAAG,CAAC,KAAc,EAAE,MAAe,EAAE,SAAkB,EAAE,UAAmB;QAChG,MAAM,MAAM,GAAG,cAAc,CAAC;QAC9B,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACzC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC1C,MAAM,CAAC,SAAS,GAAG,SAAS,IAAI,MAAM,CAAC,SAAS,CAAC;QACjD,MAAM,CAAC,UAAU,GAAG,UAAU,IAAI,MAAM,CAAC,UAAU,CAAC;QAEpD,IAAA,uCAAyB,EAAC,cAAc,CAAC,CAAC;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC;IAEe,KAAK,CAAC,WAAW,CAAC,GAAG,KAAe;QAClD,MAAM,IAAI,GAAG,IAAA,qBAAS,EAAC,KAAK,CAAC,CAAC;QAC9B,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IAClG,CAAC;;AAhCH,wCAiCC;AAhCwB,qBAAM,GAAG,gBAAgB,CAAC;AAIjD;;GAEG;AACoB,mBAAI,GAAG,IAAI,YAAY,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAE7D,iGAAiG;AACnF,wBAAS,GAAG,GAAG,CAAC;AAE9B;;GAEG;AACW,yBAAU,GAAG,GAAG,CAAC","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/** @packageDocumentation\n * @module Effects\n */\n\nimport { ScreenSpaceEffectBuilder, Tool, UniformType, VaryingType } from \"@itwin/core-frontend\";\nimport { parseArgs } from \"../tools/parseArgs\";\nimport { AddEffectTool, refreshViewportsForEffect } from \"./EffectTools\";\n\n/** Applies a [vignette](https://en.wikipedia.org/wiki/Vignetting) effect to the viewport.\n * From https://github.com/TyLindberg/glsl-vignette/blob/master/advanced.glsl.\n * @beta\n */\nexport class VignetteEffect extends AddEffectTool {\n public static override toolId = \"VignetteEffect\";\n\n protected get effectName() { return \"Vignette\"; }\n protected get textureCoordFromPosition() { return true; }\n\n protected get source() {\n return {\n vertex: `\n void effectMain(vec4 pos) {\n v_texCoord = textureCoordFromPosition(pos);\n }\n `,\n fragment: `\n float sdSquare(vec2 point, float width) {\n vec2 d = abs(point) - width;\n return min(max(d.x,d.y),0.0) + length(max(d,0.0));\n }\n\n float vignette(vec2 uv, vec2 size, float roundness, float smoothness) {\n // Center UVs\n uv -= 0.5;\n\n // Shift UVs based on the larger of width or height\n float minWidth = min(size.x, size.y);\n uv.x = sign(uv.x) * clamp(abs(uv.x) - abs(minWidth - size.x), 0.0, 1.0);\n uv.y = sign(uv.y) * clamp(abs(uv.y) - abs(minWidth - size.y), 0.0, 1.0);\n\n // Signed distance calculation\n float boxSize = minWidth * (1.0 - roundness);\n float dist = sdSquare(uv, boxSize) - (minWidth * roundness);\n\n return 1.0 - smoothstep(0.0, smoothness, dist);\n }\n\n vec4 effectMain() {\n return TEXTURE(u_diffuse, v_texCoord) * vignette(v_texCoord, u_size, u_roundness, u_smoothness);\n }\n `,\n };\n }\n\n protected defineEffect(builder: ScreenSpaceEffectBuilder): void {\n builder.addVarying(\"v_texCoord\", VaryingType.Vec2);\n builder.addUniform({\n name: \"u_size\",\n type: UniformType.Vec2,\n bind: (uniform) => uniform.setUniform2fv(VignetteConfig.size),\n });\n builder.addUniform({\n name: \"u_roundness\",\n type: UniformType.Float,\n bind: (uniform) => uniform.setUniform1f(VignetteConfig.roundness),\n });\n builder.addUniform({\n name: \"u_smoothness\",\n type: UniformType.Float,\n bind: (uniform) => uniform.setUniform1f(VignetteConfig.smoothness),\n });\n }\n}\n\n/** Configures the [[VignetteEffect]].\n * @beta\n */\nexport class VignetteConfig extends Tool {\n public static override toolId = \"VignetteConfig\";\n public static override get minArgs() { return 0; }\n public static override get maxArgs() { return 4; }\n\n /** Size of the vignette in the form (width/2, height/2). e.g., to make the vignette start fading in halfway between the center and edges of\n * UV space, use (0.25, 0.25).\n */\n public static readonly size = new Float32Array([0.25, 0.25]);\n\n /** How round the vignette will be, from 0.0 (perfectly rectangular) to 1.0 (perfectly round). */\n public static roundness = 1.0;\n\n /** How quickly the vignette fades in. The vignette starts fading in at the edge of the values provided by `size` and will be\n * fully faded in at (size.x + smoothness, size.y * smoothness). A value of 0.0 produces a hard edge.\n */\n public static smoothness = 0.5;\n\n public override async run(width?: number, height?: number, roundness?: number, smoothness?: number): Promise<boolean> {\n const config = VignetteConfig;\n config.size[0] = width ?? config.size[0];\n config.size[1] = height ?? config.size[1];\n config.roundness = roundness ?? config.roundness;\n config.smoothness = smoothness ?? config.smoothness;\n\n refreshViewportsForEffect(\"fdt Vignette\");\n return true;\n }\n\n public override async parseAndRun(...input: string[]): Promise<boolean> {\n const args = parseArgs(input);\n return this.run(args.getFloat(\"w\"), args.getFloat(\"h\"), args.getFloat(\"r\"), args.getFloat(\"s\"));\n }\n}\n"]}
1
+ {"version":3,"file":"Vignette.js","sourceRoot":"","sources":["../../../src/effects/Vignette.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,wDAAgG;AAChG,kDAA+C;AAC/C,+CAAyE;AAEzE;;;GAGG;AACH,MAAa,cAAe,SAAQ,2BAAa;aACxB,WAAM,GAAG,gBAAgB,CAAC;IAEjD,IAAc,UAAU,KAAK,OAAO,UAAU,CAAC,CAAC,CAAC;IACjD,IAAc,wB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S,GAAG,GAAG,CAAC;IAE9B;;OAEG;aACW,eAAU,GAAG,GAAG,CAAC;IAEf,KAAK,CAAC,GAAG,CAAC,KAAc,EAAE,MAAe,EAAE,SAAkB,EAAE,UAAmB;QAChG,MAAM,MAAM,GAAG,cAAc,CAAC;QAC9B,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACzC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC1C,MAAM,CAAC,SAAS,GAAG,SAAS,IAAI,MAAM,CAAC,SAAS,CAAC;QACjD,MAAM,CAAC,UAAU,GAAG,UAAU,IAAI,MAAM,CAAC,UAAU,CAAC;QAEpD,IAAA,uCAAyB,EAAC,cAAc,CAAC,CAAC;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC;IAEe,KAAK,CAAC,WAAW,CAAC,GAAG,KAAe;QAClD,MAAM,IAAI,GAAG,IAAA,qBAAS,EAAC,KAAK,CAAC,CAAC;QAC9B,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IAClG,CAAC;;AAhCH,wCAiCC","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/** @packageDocumentation\n * @module Effects\n */\n\nimport { ScreenSpaceEffectBuilder, Tool, UniformType, VaryingType } from \"@itwin/core-frontend\";\nimport { parseArgs } from \"../tools/parseArgs\";\nimport { AddEffectTool, refreshViewportsForEffect } from \"./EffectTools\";\n\n/** Applies a [vignette](https://en.wikipedia.org/wiki/Vignetting) effect to the viewport.\n * From https://github.com/TyLindberg/glsl-vignette/blob/master/advanced.glsl.\n * @beta\n */\nexport class VignetteEffect extends AddEffectTool {\n public static override toolId = \"VignetteEffect\";\n\n protected get effectName() { return \"Vignette\"; }\n protected get textureCoordFromPosition() { return true; }\n\n protected get source() {\n return {\n vertex: `\n void effectMain(vec4 pos) {\n v_texCoord = textureCoordFromPosition(pos);\n }\n `,\n fragment: `\n float sdSquare(vec2 point, float width) {\n vec2 d = abs(point) - width;\n return min(max(d.x,d.y),0.0) + length(max(d,0.0));\n }\n\n float vignette(vec2 uv, vec2 size, float roundness, float smoothness) {\n // Center UVs\n uv -= 0.5;\n\n // Shift UVs based on the larger of width or height\n float minWidth = min(size.x, size.y);\n uv.x = sign(uv.x) * clamp(abs(uv.x) - abs(minWidth - size.x), 0.0, 1.0);\n uv.y = sign(uv.y) * clamp(abs(uv.y) - abs(minWidth - size.y), 0.0, 1.0);\n\n // Signed distance calculation\n float boxSize = minWidth * (1.0 - roundness);\n float dist = sdSquare(uv, boxSize) - (minWidth * roundness);\n\n return 1.0 - smoothstep(0.0, smoothness, dist);\n }\n\n vec4 effectMain() {\n return TEXTURE(u_diffuse, v_texCoord) * vignette(v_texCoord, u_size, u_roundness, u_smoothness);\n }\n `,\n };\n }\n\n protected defineEffect(builder: ScreenSpaceEffectBuilder): void {\n builder.addVarying(\"v_texCoord\", VaryingType.Vec2);\n builder.addUniform({\n name: \"u_size\",\n type: UniformType.Vec2,\n bind: (uniform) => uniform.setUniform2fv(VignetteConfig.size),\n });\n builder.addUniform({\n name: \"u_roundness\",\n type: UniformType.Float,\n bind: (uniform) => uniform.setUniform1f(VignetteConfig.roundness),\n });\n builder.addUniform({\n name: \"u_smoothness\",\n type: UniformType.Float,\n bind: (uniform) => uniform.setUniform1f(VignetteConfig.smoothness),\n });\n }\n}\n\n/** Configures the [[VignetteEffect]].\n * @beta\n */\nexport class VignetteConfig extends Tool {\n public static override toolId = \"VignetteConfig\";\n public static override get minArgs() { return 0; }\n public static override get maxArgs() { return 4; }\n\n /** Size of the vignette in the form (width/2, height/2). e.g., to make the vignette start fading in halfway between the center and edges of\n * UV space, use (0.25, 0.25).\n */\n public static readonly size = new Float32Array([0.25, 0.25]);\n\n /** How round the vignette will be, from 0.0 (perfectly rectangular) to 1.0 (perfectly round). */\n public static roundness = 1.0;\n\n /** How quickly the vignette fades in. The vignette starts fading in at the edge of the values provided by `size` and will be\n * fully faded in at (size.x + smoothness, size.y * smoothness). A value of 0.0 produces a hard edge.\n */\n public static smoothness = 0.5;\n\n public override async run(width?: number, height?: number, roundness?: number, smoothness?: number): Promise<boolean> {\n const config = VignetteConfig;\n config.size[0] = width ?? config.size[0];\n config.size[1] = height ?? config.size[1];\n config.roundness = roundness ?? config.roundness;\n config.smoothness = smoothness ?? config.smoothness;\n\n refreshViewportsForEffect(\"fdt Vignette\");\n return true;\n }\n\n public override async parseAndRun(...input: string[]): Promise<boolean> {\n const args = parseArgs(input);\n return this.run(args.getFloat(\"w\"), args.getFloat(\"h\"), args.getFloat(\"r\"), args.getFloat(\"s\"));\n }\n}\n"]}
@@ -14,6 +14,7 @@ const core_frontend_1 = require("@itwin/core-frontend");
14
14
  * @beta
15
15
  */
16
16
  class AnimationIntervalTool extends core_frontend_1.Tool {
17
+ static { this.toolId = "AnimationInterval"; }
17
18
  static get minArgs() { return 1; }
18
19
  static get maxArgs() { return 1; }
19
20
  async run(interval) {
@@ -27,5 +28,4 @@ class AnimationIntervalTool extends core_frontend_1.Tool {
27
28
  }
28
29
  }
29
30
  exports.AnimationIntervalTool = AnimationIntervalTool;
30
- AnimationIntervalTool.toolId = "AnimationInterval";
31
31
  //# sourceMappingURL=AnimationIntervalTool.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AnimationIntervalTool.js","sourceRoot":"","sources":["../../../src/tools/AnimationIntervalTool.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,sDAAiD;AACjD,wDAAuD;AAEvD;;GAEG;AACH,MAAa,qBAAsB,SAAQ,oBAAI;IAEtC,MAAM,KAAc,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3C,MAAM,KAAc,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAElC,KAAK,CAAC,GAAG,CAAC,QAAqB;QAC7C,yBAAS,CAAC,iBAAiB,GAAG,QAAQ,CAAC;QACvC,OAAO,IAAI,CAAC;IACd,CAAC;IAEe,KAAK,CAAC,WAAW,CAAC,GAAG,IAAc;QACjD,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC5C,MAAM,QAAQ,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,yBAAU,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACzF,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC5B,CAAC;;AAdH,sDAeC;AAdwB,4BAAM,GAAG,mBAAmB,CAAC","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 Tools\n */\n\nimport { BeDuration } from \"@itwin/core-bentley\";\nimport { IModelApp, Tool } from \"@itwin/core-frontend\";\n\n/** Changes the [IModelApp.animationInterval]($frontend). Specify the interval in integer milliseconds; or pass any string not parseable as an integer to disable the animation interval callback.\n * @beta\n */\nexport class AnimationIntervalTool extends Tool {\n public static override toolId = \"AnimationInterval\";\n public static override get minArgs() { return 1; }\n public static override get maxArgs() { return 1; }\n\n public override async run(interval?: BeDuration): Promise<boolean> {\n IModelApp.animationInterval = interval;\n return true;\n }\n\n public override async parseAndRun(...args: string[]): Promise<boolean> {\n const millis = Number.parseInt(args[0], 10);\n const interval = !Number.isNaN(millis) ? BeDuration.fromMilliseconds(millis) : undefined;\n return this.run(interval);\n }\n}\n"]}
1
+ {"version":3,"file":"AnimationIntervalTool.js","sourceRoot":"","sources":["../../../src/tools/AnimationIntervalTool.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,sDAAiD;AACjD,wDAAuD;AAEvD;;GAEG;AACH,MAAa,qBAAsB,SAAQ,oBAAI;aACtB,WAAM,GAAG,mBAAmB,CAAC;IAC7C,MAAM,KAAc,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3C,MAAM,KAAc,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAElC,KAAK,CAAC,GAAG,CAAC,QAAqB;QAC7C,yBAAS,CAAC,iBAAiB,GAAG,QAAQ,CAAC;QACvC,OAAO,IAAI,CAAC;IACd,CAAC;IAEe,KAAK,CAAC,WAAW,CAAC,GAAG,IAAc;QACjD,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC5C,MAAM,QAAQ,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,yBAAU,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACzF,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC5B,CAAC;;AAdH,sDAeC","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 Tools\n */\n\nimport { BeDuration } from \"@itwin/core-bentley\";\nimport { IModelApp, Tool } from \"@itwin/core-frontend\";\n\n/** Changes the [IModelApp.animationInterval]($frontend). Specify the interval in integer milliseconds; or pass any string not parseable as an integer to disable the animation interval callback.\n * @beta\n */\nexport class AnimationIntervalTool extends Tool {\n public static override toolId = \"AnimationInterval\";\n public static override get minArgs() { return 1; }\n public static override get maxArgs() { return 1; }\n\n public override async run(interval?: BeDuration): Promise<boolean> {\n IModelApp.animationInterval = interval;\n return true;\n }\n\n public override async parseAndRun(...args: string[]): Promise<boolean> {\n const millis = Number.parseInt(args[0], 10);\n const interval = !Number.isNaN(millis) ? BeDuration.fromMilliseconds(millis) : undefined;\n return this.run(interval);\n }\n}\n"]}
@@ -16,6 +16,7 @@ const parseToggle_1 = require("./parseToggle");
16
16
  * @beta
17
17
  */
18
18
  class ChangeUnitsTool extends core_frontend_1.Tool {
19
+ static { this.toolId = "ChangeUnits"; }
19
20
  static get minArgs() { return 0; }
20
21
  static get maxArgs() { return 1; }
21
22
  // support boolean for backwards compatibility
@@ -38,5 +39,4 @@ class ChangeUnitsTool extends core_frontend_1.Tool {
38
39
  }
39
40
  }
40
41
  exports.ChangeUnitsTool = ChangeUnitsTool;
41
- ChangeUnitsTool.toolId = "ChangeUnits";
42
42
  //# sourceMappingURL=ChangeUnitsTool.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChangeUnitsTool.js","sourceRoot":"","sources":["../../../src/tools/ChangeUnitsTool.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,wDAAuD;AACvD,+CAA4C;AAE5C,sBAAsB;AAEtB;;;GAGG;AACH,MAAa,eAAgB,SAAQ,oBAAI;IAEhC,MAAM,KAAc,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3C,MAAM,KAAc,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAElD,8CAA8C;IAC9B,KAAK,CAAC,GAAG,CAAC,SAAmB;QAC3C,MAAM,IAAI,GAAG,yBAAS,CAAC,iBAAiB,CAAC;QAEzC,kEAAkE;QAClE,MAAM,WAAW,GAAG,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,KAAK,QAAQ,CAAC;QAC9F,MAAM,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC;QAEvD,IAAI,UAAU,KAAK,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACzC,MAAM,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;YAC3C,MAAM,yBAAS,CAAC,SAAS,CAAC,gBAAgB,EAAE,CAAC;QAC/C,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAEe,KAAK,CAAC,WAAW,CAAC,GAAG,IAAc;QACjD,MAAM,MAAM,GAAG,IAAA,yBAAW,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACpC,IAAI,OAAO,MAAM,KAAK,QAAQ;YAC5B,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAEzB,OAAO,IAAI,CAAC;IACd,CAAC;;AA3BH,0CA4BC;AA3BwB,sBAAM,GAAG,aAAa,CAAC","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 Tools\n */\n\nimport { IModelApp, Tool } from \"@itwin/core-frontend\";\nimport { parseToggle } from \"./parseToggle\";\n\n// CSpell: ignore fmtr\n\n/** Controls whether quantities are formatted using imperial or metric units.\n * Such formatting is used in many places; one example is the output of the MeasureTool.\n * @beta\n */\nexport class ChangeUnitsTool extends Tool {\n public static override toolId = \"ChangeUnits\";\n public static override get minArgs() { return 0; }\n public static override get maxArgs() { return 1; }\n\n // support boolean for backwards compatibility\n public override async run(useMetric?: boolean): Promise<boolean> {\n const fmtr = IModelApp.quantityFormatter;\n\n // if no arg then toggle to metric from any non-metric unit system\n const useImperial = undefined !== useMetric ? !useMetric : fmtr.activeUnitSystem === \"metric\";\n const unitSystem = useImperial ? \"imperial\" : \"metric\";\n\n if (unitSystem !== fmtr.activeUnitSystem) {\n await fmtr.setActiveUnitSystem(unitSystem);\n await IModelApp.toolAdmin.startDefaultTool();\n }\n\n return true;\n }\n\n public override async parseAndRun(...args: string[]): Promise<boolean> {\n const enable = parseToggle(args[0]);\n if (typeof enable !== \"string\")\n await this.run(enable);\n\n return true;\n }\n}\n"]}
1
+ {"version":3,"file":"ChangeUnitsTool.js","sourceRoot":"","sources":["../../../src/tools/ChangeUnitsTool.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,wDAAuD;AACvD,+CAA4C;AAE5C,sBAAsB;AAEtB;;;GAGG;AACH,MAAa,eAAgB,SAAQ,oBAAI;aAChB,WAAM,GAAG,aAAa,CAAC;IACvC,MAAM,KAAc,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3C,MAAM,KAAc,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAElD,8CAA8C;IAC9B,KAAK,CAAC,GAAG,CAAC,SAAmB;QAC3C,MAAM,IAAI,GAAG,yBAAS,CAAC,iBAAiB,CAAC;QAEzC,kEAAkE;QAClE,MAAM,WAAW,GAAG,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,KAAK,QAAQ,CAAC;QAC9F,MAAM,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC;QAEvD,IAAI,UAAU,KAAK,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACzC,MAAM,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;YAC3C,MAAM,yBAAS,CAAC,SAAS,CAAC,gBAAgB,EAAE,CAAC;QAC/C,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAEe,KAAK,CAAC,WAAW,CAAC,GAAG,IAAc;QACjD,MAAM,MAAM,GAAG,IAAA,yBAAW,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACpC,IAAI,OAAO,MAAM,KAAK,QAAQ;YAC5B,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAEzB,OAAO,IAAI,CAAC;IACd,CAAC;;AA3BH,0CA4BC","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 Tools\n */\n\nimport { IModelApp, Tool } from \"@itwin/core-frontend\";\nimport { parseToggle } from \"./parseToggle\";\n\n// CSpell: ignore fmtr\n\n/** Controls whether quantities are formatted using imperial or metric units.\n * Such formatting is used in many places; one example is the output of the MeasureTool.\n * @beta\n */\nexport class ChangeUnitsTool extends Tool {\n public static override toolId = \"ChangeUnits\";\n public static override get minArgs() { return 0; }\n public static override get maxArgs() { return 1; }\n\n // support boolean for backwards compatibility\n public override async run(useMetric?: boolean): Promise<boolean> {\n const fmtr = IModelApp.quantityFormatter;\n\n // if no arg then toggle to metric from any non-metric unit system\n const useImperial = undefined !== useMetric ? !useMetric : fmtr.activeUnitSystem === \"metric\";\n const unitSystem = useImperial ? \"imperial\" : \"metric\";\n\n if (unitSystem !== fmtr.activeUnitSystem) {\n await fmtr.setActiveUnitSystem(unitSystem);\n await IModelApp.toolAdmin.startDefaultTool();\n }\n\n return true;\n }\n\n public override async parseAndRun(...args: string[]): Promise<boolean> {\n const enable = parseToggle(args[0]);\n if (typeof enable !== \"string\")\n await this.run(enable);\n\n return true;\n }\n}\n"]}
@@ -29,6 +29,7 @@ const DisplayStyleTools_1 = require("./DisplayStyleTools");
29
29
  * @beta
30
30
  */
31
31
  class ClipColorTool extends core_frontend_1.Tool {
32
+ static { this.toolId = "ClipColorTool"; }
32
33
  static get minArgs() { return 1; }
33
34
  static get maxArgs() { return 2; }
34
35
  _clearClipColors() {
@@ -74,7 +75,6 @@ class ClipColorTool extends core_frontend_1.Tool {
74
75
  }
75
76
  }
76
77
  exports.ClipColorTool = ClipColorTool;
77
- ClipColorTool.toolId = "ClipColorTool";
78
78
  /** This tool specifies or un-specifies a color and width to use for pixels within the specified width of a clip plane.
79
79
  * Arguments can be:
80
80
  * - off
@@ -92,6 +92,7 @@ ClipColorTool.toolId = "ClipColorTool";
92
92
  * @beta
93
93
  */
94
94
  class ClipIntersectionTool extends core_frontend_1.Tool {
95
+ static { this.toolId = "ClipIntersectionTool"; }
95
96
  static get minArgs() { return 0; }
96
97
  static get maxArgs() { return 4; }
97
98
  _toggleIntersectionStyle(toggle) {
@@ -162,11 +163,11 @@ class ClipIntersectionTool extends core_frontend_1.Tool {
162
163
  }
163
164
  }
164
165
  exports.ClipIntersectionTool = ClipIntersectionTool;
165
- ClipIntersectionTool.toolId = "ClipIntersectionTool";
166
166
  /** Controls a view state's view details' flag for producing cut geometry for a clip style.
167
167
  * @beta
168
168
  */
169
169
  class ToggleSectionCutTool extends core_frontend_1.Tool {
170
+ static { this.toolId = "ToggleSectionCut"; }
170
171
  static get minArgs() { return 0; }
171
172
  static get maxArgs() { return 1; }
172
173
  /** This method runs the tool, controlling a view state's view details' flag for producing cut geometry for a clip style.
@@ -199,7 +200,6 @@ class ToggleSectionCutTool extends core_frontend_1.Tool {
199
200
  }
200
201
  }
201
202
  exports.ToggleSectionCutTool = ToggleSectionCutTool;
202
- ToggleSectionCutTool.toolId = "ToggleSectionCut";
203
203
  /** Simple tool that toggles a hard-coded clip style overriding various aspects of the cut geometry appearance.
204
204
  * @beta
205
205
  */
@@ -208,6 +208,7 @@ class TestClipStyleTool extends DisplayStyleTools_1.DisplayStyleTool {
208
208
  super(...arguments);
209
209
  this._useStyle = false;
210
210
  }
211
+ static { this.toolId = "TestClipStyle"; }
211
212
  static get maxArgs() { return 2; }
212
213
  static get minArgs() { return 1; }
213
214
  get require3d() { return true; }
@@ -251,5 +252,4 @@ class TestClipStyleTool extends DisplayStyleTools_1.DisplayStyleTool {
251
252
  }
252
253
  }
253
254
  exports.TestClipStyleTool = TestClipStyleTool;
254
- TestClipStyleTool.toolId = "TestClipStyle";
255
255
  //# sourceMappingURL=ClipTools.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ClipTools.js","sourceRoot":"","sources":["../../../src/tools/ClipTools.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,oDAE4B;AAC5B,wDAAiE;AACjE,+CAA4C;AAC5C,iDAA8C;AAC9C,2DAAuD;AAEvD;;;;;;;;;;;;;;GAcG;AACH,MAAa,aAAc,SAAQ,oBAAI;IAE9B,MAAM,KAAc,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3C,MAAM,KAAc,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAE1C,gBAAgB;QACtB,MAAM,EAAE,GAAG,yBAAS,CAAC,WAAW,CAAC,YAAY,CAAC;QAC9C,IAAI,SAAS,KAAK,EAAE,EAAE,CAAC;YACrB,MAAM,KAAK,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC;YAChE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,YAAY,GAAG,SAAS,CAAC;YACnD,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,GAAG,uBAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;IAEO,YAAY,CAAC,MAAc,EAAE,KAAqC;QACxE,MAAM,EAAE,GAAG,yBAAS,CAAC,WAAW,CAAC,YAAY,CAAC;QAC9C,IAAI,EAAE,EAAE,CAAC;YACP,MAAM,KAAK,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC;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ED,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,GAAG,uBAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC/D,EAAE,CAAC,oBAAoB,EAAE,CAAC;QAC1B,EAAE,CAAC,iCAAiC,EAAE,CAAC;QAEvC,OAAO,IAAI,CAAC;IACd,CAAC;;AAlDH,8CAmDC;AAlDwB,wBAAM,GAAG,eAAe,AAAlB,CAAmB","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 Tools\n */\n\nimport {\n ClipIntersectionStyle, ClipStyle, ClipStyleProps, ColorByName, ColorDef, CutStyleProps, LinePixels, RenderMode, RgbColor,\n} from \"@itwin/core-common\";\nimport { IModelApp, Tool, Viewport } from \"@itwin/core-frontend\";\nimport { parseToggle } from \"./parseToggle\";\nimport { parseBoolean } from \"./parseBoolean\";\nimport { DisplayStyleTool } from \"./DisplayStyleTools\";\n\n/** This tool specifies or un-specifies a clip color to use for pixels inside or outside the clip region.\n * Arguments can be:\n * - clear\n * - inside <color string> | clear\n * - outside <color string> | clear\n * <color string> must be in one of the following forms:\n * \"rgb(255,0,0)\"\n * \"rgba(255,0,0,255)\"\n * \"rgb(100%,0%,0%)\"\n * \"hsl(120,50%,50%)\"\n * \"#rrbbgg\"\n * \"blanchedAlmond\" (see possible values from [[ColorByName]]). Case insensitive.\n * @see [ColorDef]\n * @beta\n */\nexport class ClipColorTool extends Tool {\n public static override toolId = \"ClipColorTool\";\n public static override get minArgs() { return 1; }\n public static override get maxArgs() { return 2; }\n\n private _clearClipColors() {\n const vp = IModelApp.viewManager.selectedView;\n if (undefined !== vp) {\n const props = vp.displayStyle.settings.clipStyle.toJSON() ?? {};\n props.insideColor = props.outsideColor = undefined;\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n }\n }\n\n private setClipColor(colStr: string, which: \"insideColor\" | \"outsideColor\") {\n const vp = IModelApp.viewManager.selectedView;\n if (vp) {\n const props = vp.displayStyle.settings.clipStyle.toJSON() ?? {};\n props[which] = colStr === \"clear\" ? undefined : RgbColor.fromColorDef(ColorDef.fromString(colStr));\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n }\n }\n\n /** This runs the tool using the given arguments, specifying or unspecifying a clip color to use for pixels inside or outside the clip region.\n * Arguments can be:\n * - clear\n * - inside <color string> | clear\n * - outside <color string> | clear\n * <color string> must be in one of the following forms:\n * \"rgb(255,0,0)\"\n * \"rgba(255,0,0,255)\"\n * \"rgb(100%,0%,0%)\"\n * \"hsl(120,50%,50%)\"\n * \"#rrbbgg\"\n * \"blanchedAlmond\" (see possible values from [[ColorByName]]). Case insensitive.\n * @beta\n */\n public override async parseAndRun(...args: string[]): Promise<boolean> {\n if (1 === args.length) {\n if (args[0] === \"clear\")\n this._clearClipColors();\n\n return true;\n }\n\n const which = args[0];\n if (which === \"inside\" || which === \"outside\")\n this.setClipColor(args[1], \"inside\" === which ? \"insideColor\" : \"outsideColor\");\n\n return true;\n }\n}\n\n/** This tool specifies or un-specifies a color and width to use for pixels within the specified width of a clip plane.\n * Arguments can be:\n * - off\n * - default\n * - color <color string>\n * - width <number>\n * <color string> must be in one of the following forms:\n * \"rgb(255,0,0)\"\n * \"rgba(255,0,0,255)\"\n * \"rgb(100%,0%,0%)\"\n * \"hsl(120,50%,50%)\"\n * \"#rrbbgg\"\n * \"blanchedAlmond\" (see possible values from [[ColorByName]]). Case insensitive.\n * @see [ColorDef]\n * @beta\n */\nexport class ClipIntersectionTool extends Tool {\n public static override toolId = \"ClipIntersectionTool\";\n public static override get minArgs() { return 0; }\n public static override get maxArgs() { return 4; }\n\n private _toggleIntersectionStyle(toggle: boolean) {\n const vp = IModelApp.viewManager.selectedView;\n if (undefined !== vp) {\n const props = vp.displayStyle.settings.clipStyle.toJSON() ?? {};\n props.colorizeIntersection = toggle;\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n }\n }\n\n private _defaultClipIntersection() {\n const vp = IModelApp.viewManager.selectedView;\n if (undefined !== vp) {\n const props = vp.displayStyle.settings.clipStyle.toJSON() ?? {};\n if (!props.intersectionStyle) {\n props.intersectionStyle = ClipIntersectionStyle.defaults;\n } else {\n props.intersectionStyle.color = RgbColor.fromColorDef(ColorDef.white);\n props.intersectionStyle.width = 1;\n }\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n }\n }\n\n private setClipIntersection(colStr: string, width: number) {\n const vp = IModelApp.viewManager.selectedView;\n if (vp) {\n const props = vp.displayStyle.settings.clipStyle.toJSON() ?? {};\n\n if (!props.intersectionStyle) {\n props.intersectionStyle = ClipIntersectionStyle.defaults;\n }\n if (colStr) {\n props.intersectionStyle.color = RgbColor.fromColorDef(ColorDef.fromString(colStr));\n }\n if (width) {\n props.intersectionStyle.width = width;\n }\n\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n }\n }\n\n /** This runs the tool using the given arguments, specifying or unspecifying a color and width to use for pixels within the specified width of a clip plane.\n * Arguments can be:\n * - off\n * - default\n * - color <color string>\n * - width <number>\n * <color string> must be in one of the following forms:\n * \"rgb(255,0,0)\"\n * \"rgba(255,0,0,255)\"\n * \"rgb(100%,0%,0%)\"\n * \"hsl(120,50%,50%)\"\n * \"#rrbbgg\"\n * \"blanchedAlmond\" (see possible values from [[ColorByName]]). Case insensitive.\n * @beta\n */\n public override async parseAndRun(...args: string[]): Promise<boolean> {\n if (args[0] === \"off\") {\n this._toggleIntersectionStyle(false);\n return true;\n }\n\n this._toggleIntersectionStyle(true);\n if (args[0] === \"default\") {\n this._defaultClipIntersection();\n return true;\n }\n\n args[0] === \"color\" ? this.setClipIntersection(args[1], +args[3]) : this.setClipIntersection(args[3], +args[1]);\n return true;\n }\n}\n\n/** Controls a view state's view details' flag for producing cut geometry for a clip style.\n * @beta\n */\nexport class ToggleSectionCutTool extends Tool {\n public static override toolId = \"ToggleSectionCut\";\n public static override get minArgs() { return 0; }\n public static override get maxArgs() { return 1; }\n\n /** This method runs the tool, controlling a view state's view details' flag for producing cut geometry for a clip style.\n * @param produceCutGeometry whether to produce cut geometry\n */\n public override async run(produceCutGeometry?: boolean): Promise<boolean> {\n const vp = IModelApp.viewManager.selectedView;\n if (vp) {\n const style = vp.view.displayStyle.settings.clipStyle;\n produceCutGeometry = produceCutGeometry ?? !style.produceCutGeometry;\n if (produceCutGeometry !== style.produceCutGeometry) {\n const json = {\n ...vp.view.displayStyle.settings.clipStyle.toJSON(),\n produceCutGeometry,\n };\n\n vp.view.displayStyle.settings.clipStyle = ClipStyle.fromJSON(json);\n vp.invalidateScene();\n }\n }\n\n return true;\n }\n\n /** Executes this tool's run method with args[0] containing `produceCutGeometry`.\n * @see [[run]]\n */\n public override async parseAndRun(...args: string[]): Promise<boolean> {\n const enable = parseToggle(args[0]);\n if (typeof enable !== \"string\")\n await this.run(enable);\n\n return true;\n }\n}\n\n/** Simple tool that toggles a hard-coded clip style overriding various aspects of the cut geometry appearance.\n * @beta\n */\nexport class TestClipStyleTool extends DisplayStyleTool {\n public static override toolId = \"TestClipStyle\";\n public static override get maxArgs() { return 2; }\n public static override get minArgs() { return 1; }\n\n private _useStyle = false;\n private _style?: CutStyleProps;\n\n protected override get require3d() { return true; }\n\n protected async parse(args: string[]): Promise<boolean> {\n this._useStyle = parseBoolean(args[0]) ?? false;\n if (this._useStyle && args.length > 1)\n this._style = JSON.parse(args[1]);\n return true;\n }\n\n protected async execute(vp: Viewport) {\n const props: ClipStyleProps = { produceCutGeometry: true };\n if (this._useStyle) {\n if (this._style)\n props.cutStyle = this._style;\n else\n props.cutStyle = {\n viewflags: {\n renderMode: RenderMode.SmoothShade,\n visibleEdges: true,\n hiddenEdges: false,\n },\n appearance: {\n rgb: { r: 0xff, g: 0x7f, b: 0 },\n transparency: 0.5,\n nonLocatable: true,\n },\n hiddenLine: {\n visible: {\n ovrColor: true,\n color: ColorByName.blue,\n pattern: LinePixels.Solid,\n width: 3,\n },\n },\n };\n }\n\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n vp.invalidateRenderPlan();\n vp.setFeatureOverrideProviderChanged();\n\n return true;\n }\n}\n"]}
1
+ {"version":3,"file":"ClipTools.js","sourceRoot":"","sources":["../../../src/tools/ClipTools.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,oDAE4B;AAC5B,wDAAiE;AACjE,+CAA4C;AAC5C,iDAA8C;AAC9C,2DAAuD;AAEvD;;;;;;;;;;;;;;GAcG;AACH,MAAa,aAAc,SAAQ,oBAAI;aACd,WAAM,GAAG,eAAe,CAAC;IACzC,MAAM,KAAc,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3C,MAAM,KAAc,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAE1C,gBAAgB;QACtB,MAAM,EAAE,GAAG,yBAAS,CAAC,WAAW,CAAC,YAAY,CAAC;QAC9C,IAAI,SAAS,KAAK,EAAE,EAAE,CAAC;YACrB,MAAM,KAAK,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC;YAChE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,YAAY,GAAG,SAAS,CAAC;YACnD,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,GAAG,uBAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;IAEO,YAAY,CAAC,MAAc,EAAE,KAAqC;QACxE,MAAM,EAAE,GAAG,yBAAS,CAAC,WAAW,CAAC,YAAY,CAAC;QAC9C,IAAI,EAAE,EAAE,CAAC;YACP,MAAM,KAAK,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC;YAChE,KAAK,CAAC,KA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,CAAC,SAAS,GAAG,uBAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC/D,EAAE,CAAC,oBAAoB,EAAE,CAAC;QAC1B,EAAE,CAAC,iCAAiC,EAAE,CAAC;QAEvC,OAAO,IAAI,CAAC;IACd,CAAC;;AAlDH,8CAmDC","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 Tools\n */\n\nimport {\n ClipIntersectionStyle, ClipStyle, ClipStyleProps, ColorByName, ColorDef, CutStyleProps, LinePixels, RenderMode, RgbColor,\n} from \"@itwin/core-common\";\nimport { IModelApp, Tool, Viewport } from \"@itwin/core-frontend\";\nimport { parseToggle } from \"./parseToggle\";\nimport { parseBoolean } from \"./parseBoolean\";\nimport { DisplayStyleTool } from \"./DisplayStyleTools\";\n\n/** This tool specifies or un-specifies a clip color to use for pixels inside or outside the clip region.\n * Arguments can be:\n * - clear\n * - inside <color string> | clear\n * - outside <color string> | clear\n * <color string> must be in one of the following forms:\n * \"rgb(255,0,0)\"\n * \"rgba(255,0,0,255)\"\n * \"rgb(100%,0%,0%)\"\n * \"hsl(120,50%,50%)\"\n * \"#rrbbgg\"\n * \"blanchedAlmond\" (see possible values from [[ColorByName]]). Case insensitive.\n * @see [ColorDef]\n * @beta\n */\nexport class ClipColorTool extends Tool {\n public static override toolId = \"ClipColorTool\";\n public static override get minArgs() { return 1; }\n public static override get maxArgs() { return 2; }\n\n private _clearClipColors() {\n const vp = IModelApp.viewManager.selectedView;\n if (undefined !== vp) {\n const props = vp.displayStyle.settings.clipStyle.toJSON() ?? {};\n props.insideColor = props.outsideColor = undefined;\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n }\n }\n\n private setClipColor(colStr: string, which: \"insideColor\" | \"outsideColor\") {\n const vp = IModelApp.viewManager.selectedView;\n if (vp) {\n const props = vp.displayStyle.settings.clipStyle.toJSON() ?? {};\n props[which] = colStr === \"clear\" ? undefined : RgbColor.fromColorDef(ColorDef.fromString(colStr));\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n }\n }\n\n /** This runs the tool using the given arguments, specifying or unspecifying a clip color to use for pixels inside or outside the clip region.\n * Arguments can be:\n * - clear\n * - inside <color string> | clear\n * - outside <color string> | clear\n * <color string> must be in one of the following forms:\n * \"rgb(255,0,0)\"\n * \"rgba(255,0,0,255)\"\n * \"rgb(100%,0%,0%)\"\n * \"hsl(120,50%,50%)\"\n * \"#rrbbgg\"\n * \"blanchedAlmond\" (see possible values from [[ColorByName]]). Case insensitive.\n * @beta\n */\n public override async parseAndRun(...args: string[]): Promise<boolean> {\n if (1 === args.length) {\n if (args[0] === \"clear\")\n this._clearClipColors();\n\n return true;\n }\n\n const which = args[0];\n if (which === \"inside\" || which === \"outside\")\n this.setClipColor(args[1], \"inside\" === which ? \"insideColor\" : \"outsideColor\");\n\n return true;\n }\n}\n\n/** This tool specifies or un-specifies a color and width to use for pixels within the specified width of a clip plane.\n * Arguments can be:\n * - off\n * - default\n * - color <color string>\n * - width <number>\n * <color string> must be in one of the following forms:\n * \"rgb(255,0,0)\"\n * \"rgba(255,0,0,255)\"\n * \"rgb(100%,0%,0%)\"\n * \"hsl(120,50%,50%)\"\n * \"#rrbbgg\"\n * \"blanchedAlmond\" (see possible values from [[ColorByName]]). Case insensitive.\n * @see [ColorDef]\n * @beta\n */\nexport class ClipIntersectionTool extends Tool {\n public static override toolId = \"ClipIntersectionTool\";\n public static override get minArgs() { return 0; }\n public static override get maxArgs() { return 4; }\n\n private _toggleIntersectionStyle(toggle: boolean) {\n const vp = IModelApp.viewManager.selectedView;\n if (undefined !== vp) {\n const props = vp.displayStyle.settings.clipStyle.toJSON() ?? {};\n props.colorizeIntersection = toggle;\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n }\n }\n\n private _defaultClipIntersection() {\n const vp = IModelApp.viewManager.selectedView;\n if (undefined !== vp) {\n const props = vp.displayStyle.settings.clipStyle.toJSON() ?? {};\n if (!props.intersectionStyle) {\n props.intersectionStyle = ClipIntersectionStyle.defaults;\n } else {\n props.intersectionStyle.color = RgbColor.fromColorDef(ColorDef.white);\n props.intersectionStyle.width = 1;\n }\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n }\n }\n\n private setClipIntersection(colStr: string, width: number) {\n const vp = IModelApp.viewManager.selectedView;\n if (vp) {\n const props = vp.displayStyle.settings.clipStyle.toJSON() ?? {};\n\n if (!props.intersectionStyle) {\n props.intersectionStyle = ClipIntersectionStyle.defaults;\n }\n if (colStr) {\n props.intersectionStyle.color = RgbColor.fromColorDef(ColorDef.fromString(colStr));\n }\n if (width) {\n props.intersectionStyle.width = width;\n }\n\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n }\n }\n\n /** This runs the tool using the given arguments, specifying or unspecifying a color and width to use for pixels within the specified width of a clip plane.\n * Arguments can be:\n * - off\n * - default\n * - color <color string>\n * - width <number>\n * <color string> must be in one of the following forms:\n * \"rgb(255,0,0)\"\n * \"rgba(255,0,0,255)\"\n * \"rgb(100%,0%,0%)\"\n * \"hsl(120,50%,50%)\"\n * \"#rrbbgg\"\n * \"blanchedAlmond\" (see possible values from [[ColorByName]]). Case insensitive.\n * @beta\n */\n public override async parseAndRun(...args: string[]): Promise<boolean> {\n if (args[0] === \"off\") {\n this._toggleIntersectionStyle(false);\n return true;\n }\n\n this._toggleIntersectionStyle(true);\n if (args[0] === \"default\") {\n this._defaultClipIntersection();\n return true;\n }\n\n args[0] === \"color\" ? this.setClipIntersection(args[1], +args[3]) : this.setClipIntersection(args[3], +args[1]);\n return true;\n }\n}\n\n/** Controls a view state's view details' flag for producing cut geometry for a clip style.\n * @beta\n */\nexport class ToggleSectionCutTool extends Tool {\n public static override toolId = \"ToggleSectionCut\";\n public static override get minArgs() { return 0; }\n public static override get maxArgs() { return 1; }\n\n /** This method runs the tool, controlling a view state's view details' flag for producing cut geometry for a clip style.\n * @param produceCutGeometry whether to produce cut geometry\n */\n public override async run(produceCutGeometry?: boolean): Promise<boolean> {\n const vp = IModelApp.viewManager.selectedView;\n if (vp) {\n const style = vp.view.displayStyle.settings.clipStyle;\n produceCutGeometry = produceCutGeometry ?? !style.produceCutGeometry;\n if (produceCutGeometry !== style.produceCutGeometry) {\n const json = {\n ...vp.view.displayStyle.settings.clipStyle.toJSON(),\n produceCutGeometry,\n };\n\n vp.view.displayStyle.settings.clipStyle = ClipStyle.fromJSON(json);\n vp.invalidateScene();\n }\n }\n\n return true;\n }\n\n /** Executes this tool's run method with args[0] containing `produceCutGeometry`.\n * @see [[run]]\n */\n public override async parseAndRun(...args: string[]): Promise<boolean> {\n const enable = parseToggle(args[0]);\n if (typeof enable !== \"string\")\n await this.run(enable);\n\n return true;\n }\n}\n\n/** Simple tool that toggles a hard-coded clip style overriding various aspects of the cut geometry appearance.\n * @beta\n */\nexport class TestClipStyleTool extends DisplayStyleTool {\n public static override toolId = \"TestClipStyle\";\n public static override get maxArgs() { return 2; }\n public static override get minArgs() { return 1; }\n\n private _useStyle = false;\n private _style?: CutStyleProps;\n\n protected override get require3d() { return true; }\n\n protected async parse(args: string[]): Promise<boolean> {\n this._useStyle = parseBoolean(args[0]) ?? false;\n if (this._useStyle && args.length > 1)\n this._style = JSON.parse(args[1]);\n return true;\n }\n\n protected async execute(vp: Viewport) {\n const props: ClipStyleProps = { produceCutGeometry: true };\n if (this._useStyle) {\n if (this._style)\n props.cutStyle = this._style;\n else\n props.cutStyle = {\n viewflags: {\n renderMode: RenderMode.SmoothShade,\n visibleEdges: true,\n hiddenEdges: false,\n },\n appearance: {\n rgb: { r: 0xff, g: 0x7f, b: 0 },\n transparency: 0.5,\n nonLocatable: true,\n },\n hiddenLine: {\n visible: {\n ovrColor: true,\n color: ColorByName.blue,\n pattern: LinePixels.Solid,\n width: 3,\n },\n },\n };\n }\n\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n vp.invalidateRenderPlan();\n vp.setFeatureOverrideProviderChanged();\n\n return true;\n }\n}\n"]}
@@ -49,6 +49,7 @@ exports.DisplayStyleTool = DisplayStyleTool;
49
49
  * @beta
50
50
  */
51
51
  class ChangeViewFlagsTool extends core_frontend_1.Tool {
52
+ static { this.toolId = "ChangeViewFlags"; }
52
53
  static get maxArgs() { return undefined; }
53
54
  static get minArgs() { return 1; }
54
55
  async run(vf, vp) {
@@ -94,11 +95,11 @@ class ChangeViewFlagsTool extends core_frontend_1.Tool {
94
95
  }
95
96
  }
96
97
  exports.ChangeViewFlagsTool = ChangeViewFlagsTool;
97
- ChangeViewFlagsTool.toolId = "ChangeViewFlags";
98
98
  /** Toggles the skybox.
99
99
  * @beta
100
100
  */
101
101
  class ToggleSkyboxTool extends DisplayStyleTool {
102
+ static { this.toolId = "ToggleSkybox"; }
102
103
  get require3d() { return true; }
103
104
  async parse(_args) { return true; } // no arguments
104
105
  async execute(vp) {
@@ -108,11 +109,11 @@ class ToggleSkyboxTool extends DisplayStyleTool {
108
109
  }
109
110
  }
110
111
  exports.ToggleSkyboxTool = ToggleSkyboxTool;
111
- ToggleSkyboxTool.toolId = "ToggleSkybox";
112
112
  /** Defines a [SkySphere]($common) to apply to the current view.
113
113
  * @beta
114
114
  */
115
115
  class SkySphereTool extends DisplayStyleTool {
116
+ static { this.toolId = "SetSkySphere"; }
116
117
  static get minArgs() { return 1; }
117
118
  static get maxArgs() { return 1; }
118
119
  get require3d() { return true; }
@@ -131,7 +132,6 @@ class SkySphereTool extends DisplayStyleTool {
131
132
  }
132
133
  }
133
134
  exports.SkySphereTool = SkySphereTool;
134
- SkySphereTool.toolId = "SetSkySphere";
135
135
  /** Defines a [SkyCube]($common) to apply to the current view.
136
136
  * @beta
137
137
  */
@@ -140,6 +140,7 @@ class SkyCubeTool extends DisplayStyleTool {
140
140
  super(...arguments);
141
141
  this._images = [];
142
142
  }
143
+ static { this.toolId = "SetSkyCube"; }
143
144
  static get minArgs() { return 1; }
144
145
  static get maxArgs() { return 6; }
145
146
  get require3d() { return true; }
@@ -195,7 +196,6 @@ class SkyCubeTool extends DisplayStyleTool {
195
196
  }
196
197
  }
197
198
  exports.SkyCubeTool = SkyCubeTool;
198
- SkyCubeTool.toolId = "SetSkyCube";
199
199
  /** Outputs (and optionally copies to the clipboard) a "rendering style" as a partial DisplayStyle3dSettingsProps JSON object based
200
200
  * on the current view's display style settings.
201
201
  * All arguments are optional, of the form "name=value" where `value` is 0 for false or 1 for true. All arguments default to `false` if omitted.
@@ -217,6 +217,7 @@ class SaveRenderingStyleTool extends DisplayStyleTool {
217
217
  this._copyToClipboard = false;
218
218
  this._quote = false;
219
219
  }
220
+ static { this.toolId = "SaveRenderingStyle"; }
220
221
  static get minArgs() { return 0; }
221
222
  static get maxArgs() { return 7; }
222
223
  async parse(inputArgs) {
@@ -244,12 +245,12 @@ class SaveRenderingStyleTool extends DisplayStyleTool {
244
245
  }
245
246
  }
246
247
  exports.SaveRenderingStyleTool = SaveRenderingStyleTool;
247
- SaveRenderingStyleTool.toolId = "SaveRenderingStyle";
248
248
  /** Given a "rendering style" as a partial DisplayStyle3dSettingsProperties JSON string, apply it to the selected viewport's display style.
249
249
  * @see [DisplayStyleSettings.applyOverrides]($common) for details.
250
250
  * @beta
251
251
  */
252
252
  class ApplyRenderingStyleTool extends DisplayStyleTool {
253
+ static { this.toolId = "ApplyRenderingStyle"; }
253
254
  static get minArgs() { return 1; }
254
255
  static get maxArgs() { return 1; }
255
256
  async parse(args) {
@@ -269,7 +270,6 @@ class ApplyRenderingStyleTool extends DisplayStyleTool {
269
270
  }
270
271
  }
271
272
  exports.ApplyRenderingStyleTool = ApplyRenderingStyleTool;
272
- ApplyRenderingStyleTool.toolId = "ApplyRenderingStyle";
273
273
  /** Apply appearance overrides to one or more subcategories in the active viewport.
274
274
  * @beta
275
275
  */
@@ -279,6 +279,7 @@ class OverrideSubCategoryTool extends DisplayStyleTool {
279
279
  this._overrideProps = {};
280
280
  this._subcategoryIds = [];
281
281
  }
282
+ static { this.toolId = "OverrideSubCategory"; }
282
283
  static get minArgs() { return 1; }
283
284
  static get maxArgs() { return 7; }
284
285
  async parse(inArgs) {
@@ -304,11 +305,11 @@ class OverrideSubCategoryTool extends DisplayStyleTool {
304
305
  }
305
306
  }
306
307
  exports.OverrideSubCategoryTool = OverrideSubCategoryTool;
307
- OverrideSubCategoryTool.toolId = "OverrideSubCategory";
308
308
  /** Set whether background color is ignored when applying white-on-white reversal.
309
309
  * @beta
310
310
  */
311
311
  class WoWIgnoreBackgroundTool extends DisplayStyleTool {
312
+ static { this.toolId = "WoWIgnoreBackground"; }
312
313
  static get minArgs() { return 0; }
313
314
  static get maxArgs() { return 1; }
314
315
  async parse(args) {
@@ -325,12 +326,12 @@ class WoWIgnoreBackgroundTool extends DisplayStyleTool {
325
326
  }
326
327
  }
327
328
  exports.WoWIgnoreBackgroundTool = WoWIgnoreBackgroundTool;
328
- WoWIgnoreBackgroundTool.toolId = "WoWIgnoreBackground";
329
329
  /** Toggle whether surfaces display with overlaid wiremesh in the active viewport.
330
330
  * @see [ViewFlags.wiremesh]($common).
331
331
  * @beta
332
332
  */
333
333
  class ToggleWiremeshTool extends DisplayStyleTool {
334
+ static { this.toolId = "ToggleWiremesh"; }
334
335
  static get minArgs() { return 0; }
335
336
  static get maxArgs() { return 1; }
336
337
  async parse(args) {
@@ -346,11 +347,11 @@ class ToggleWiremeshTool extends DisplayStyleTool {
346
347
  }
347
348
  }
348
349
  exports.ToggleWiremeshTool = ToggleWiremeshTool;
349
- ToggleWiremeshTool.toolId = "ToggleWiremesh";
350
350
  /** Change the background color of the active viewport and optionally its transparency.
351
351
  * @beta
352
352
  */
353
353
  class ChangeBackgroundColorTool extends DisplayStyleTool {
354
+ static { this.toolId = "ChangeBackgroundColor"; }
354
355
  static get minArgs() { return 1; }
355
356
  static get maxArgs() { return 1; }
356
357
  async parse(args) {
@@ -365,5 +366,4 @@ class ChangeBackgroundColorTool extends DisplayStyleTool {
365
366
  }
366
367
  }
367
368
  exports.ChangeBackgroundColorTool = ChangeBackgroundColorTool;
368
- ChangeBackgroundColorTool.toolId = "ChangeBackgroundColor";
369
369
  //# sourceMappingURL=DisplayStyleTools.js.map