@itwin/frontend-devtools 3.3.0-dev.24 → 3.3.0-dev.27

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 CHANGED
@@ -1,6 +1,11 @@
1
1
  # Change Log - @itwin/frontend-devtools
2
2
 
3
- This log was last generated on Fri, 20 May 2022 13:10:54 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 07 Jun 2022 15:02:56 GMT and should not be manually modified.
4
+
5
+ ## 3.2.1
6
+ Tue, 07 Jun 2022 15:02:56 GMT
7
+
8
+ _Version update only_
4
9
 
5
10
  ## 3.2.0
6
11
  Fri, 20 May 2022 13:10:54 GMT
@@ -11,6 +11,7 @@ export declare class ProjectExtentsDecoration {
11
11
  constructor(iModel: IModelConnection);
12
12
  protected stop(): void;
13
13
  protected updateDecorationListener(add: boolean): void;
14
+ static get isActive(): boolean;
14
15
  /** This will allow the render system to cache and reuse the decorations created by this decorator's decorate() method. */
15
16
  readonly useCachedDecorations = true;
16
17
  decorate(context: DecorateContext): void;
@@ -1 +1 @@
1
- {"version":3,"file":"ProjectExtents.d.ts","sourceRoot":"","sources":["../../../src/tools/ProjectExtents.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAwB,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,eAAe,EAA0B,gBAAgB,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAGvG,YAAY;AACZ,qBAAa,wBAAwB;IACnC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAA2B;IACrD,SAAS,CAAC,yBAAyB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjD,SAAS,CAAC,QAAQ,EAAE,gBAAgB,CAAC;gBAElB,MAAM,EAAE,gBAAgB;IAK3C,SAAS,CAAC,IAAI,IAAI,IAAI;IAEtB,SAAS,CAAC,wBAAwB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI;IAYtD,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AAC,OAAO,EAAE,eAAe,GAAG,IAAI;WAqBjC,MAAM,CAAC,MAAM,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO;CAgB3E;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAEzF;AAED;;;;;;;GAOG;AACH,qBAAa,wBAAyB,SAAQ,IAAI;IAChD,OAAuB,MAAM,SAA0B;IACvD,WAA2B,OAAO,WAAgB;IAClD,WAA2B,OAAO,WAAgB;IAE5B,GAAG,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAWvC,WAAW,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;CAOvE"}
@@ -32,6 +32,9 @@ class ProjectExtentsDecoration {
32
32
  this._removeDecorationListener = core_frontend_1.IModelApp.viewManager.addDecorator(this);
33
33
  }
34
34
  }
35
+ static get isActive() {
36
+ return undefined !== ProjectExtentsDecoration._decorator;
37
+ }
35
38
  decorate(context) {
36
39
  const vp = context.viewport;
37
40
  if (!vp.view.isSpatialView())
@@ -1 +1 @@
1
- {"version":3,"file":"ProjectExtents.js","sourceRoot":"","sources":["../../../src/tools/ProjectExtents.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,oDAA4E;AAC5E,wDAAuG;AACvG,+CAA4C;AAE5C,YAAY;AACZ,MAAa,wBAAwB;IAKnC,YAAmB,MAAwB;QAmB3C,0HAA0H;QAC1G,yBAAoB,GAAG,IAAI,CAAC;QAnB1C,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,cAAc,CAAC;QACtC,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAES,IAAI,KAAW,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAE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Y,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,oBAAoB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;SACtE;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;;AAtBH,4DAuBC;AAtBwB,+BAAM,GAAG,sBAAsB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Tools\r\n */\r\n\r\nimport { AxisAlignedBox3d, ColorDef, LinePixels } from \"@itwin/core-common\";\r\nimport { DecorateContext, GraphicType, IModelApp, IModelConnection, Tool } from \"@itwin/core-frontend\";\r\nimport { parseToggle } from \"./parseToggle\";\r\n\r\n/** @beta */\r\nexport class ProjectExtentsDecoration {\r\n private static _decorator?: ProjectExtentsDecoration;\r\n protected _removeDecorationListener?: () => void;\r\n protected _extents: AxisAlignedBox3d;\r\n\r\n public constructor(iModel: IModelConnection) {\r\n this._extents = iModel.projectExtents;\r\n this.updateDecorationListener(true);\r\n }\r\n\r\n protected stop(): void { this.updateDecorationListener(false); }\r\n\r\n protected updateDecorationListener(add: boolean): void {\r\n if (this._removeDecorationListener) {\r\n if (!add) {\r\n this._removeDecorationListener();\r\n this._removeDecorationListener = undefined;\r\n }\r\n } else if (add) {\r\n if (!this._removeDecorationListener)\r\n this._removeDecorationListener = IModelApp.viewManager.addDecorator(this);\r\n }\r\n }\r\n\r\n /** This will allow the render system to cache and reuse the decorations created by this decorator's decorate() method. */\r\n public readonly useCachedDecorations = true;\r\n\r\n public decorate(context: DecorateContext): void {\r\n const vp = context.viewport;\r\n if (!vp.view.isSpatialView())\r\n return;\r\n\r\n const builderAccVis = context.createGraphicBuilder(GraphicType.WorldDecoration);\r\n const builderAccHid = context.createGraphicBuilder(GraphicType.WorldOverlay);\r\n const colorAccVis = ColorDef.white.adjustedForContrast(context.viewport.view.backgroundColor);\r\n const colorAccHid = colorAccVis.withAlpha(100);\r\n\r\n builderAccVis.setSymbology(colorAccVis, ColorDef.black, 3);\r\n builderAccHid.setSymbology(colorAccHid, ColorDef.black, 1, LinePixels.Code2);\r\n\r\n builderAccVis.addRangeBox(this._extents);\r\n builderAccHid.addRangeBox(this._extents);\r\n\r\n context.addDecorationFromBuilder(builderAccVis);\r\n context.addDecorationFromBuilder(builderAccHid);\r\n }\r\n\r\n // Returns true if extents become enabled.\r\n public static toggle(imodel: IModelConnection, enabled?: boolean): boolean {\r\n if (undefined !== enabled) {\r\n const alreadyEnabled = undefined !== ProjectExtentsDecoration._decorator;\r\n if (enabled === alreadyEnabled)\r\n return alreadyEnabled;\r\n }\r\n\r\n if (undefined === ProjectExtentsDecoration._decorator) {\r\n ProjectExtentsDecoration._decorator = new ProjectExtentsDecoration(imodel);\r\n return true;\r\n } else {\r\n ProjectExtentsDecoration._decorator.stop();\r\n ProjectExtentsDecoration._decorator = undefined;\r\n return false;\r\n }\r\n }\r\n}\r\n\r\n/** Enable or disable the project extents decoration. This decoration draws a box coinciding with the iModel's project extents.\r\n * @param imodel The iModel from which to obtain the extents.\r\n * @param enable If undefined, the current enabled state of the decoration will be inverted; otherwise it will be enabled if true, or disabled if false.\r\n * @returns true if the extents are now ON, false if they are now OFF.\r\n * @beta\r\n */\r\nexport function toggleProjectExtents(imodel: IModelConnection, enabled?: boolean): boolean {\r\n return ProjectExtentsDecoration.toggle(imodel, enabled);\r\n}\r\n\r\n/** Enable or disable project extents decoration.\r\n * The key-in takes at most 1 argument (case-insensitive):\r\n * - \"ON\" => enable project extents\r\n * - \"OFF\" => disable project extents\r\n * - \"TOGGLE\" or omitted => toggle project extents\r\n * @see [toggleProjectExtents]\r\n * @beta\r\n */\r\nexport class ToggleProjectExtentsTool extends Tool {\r\n public static override toolId = \"ToggleProjectExtents\";\r\n public static override get minArgs() { return 0; }\r\n public static override get maxArgs() { return 1; }\r\n\r\n public override async run(enable?: boolean): Promise<boolean> {\r\n const vp = IModelApp.viewManager.selectedView;\r\n if (undefined !== vp && vp.view.isSpatialView()) {\r\n const iModel = vp.iModel;\r\n if (toggleProjectExtents(iModel, enable))\r\n vp.onChangeView.addOnce(() => toggleProjectExtents(iModel, false));\r\n }\r\n\r\n return true;\r\n }\r\n\r\n public override async parseAndRun(...args: string[]): Promise<boolean> {\r\n const enable = parseToggle(args[0]);\r\n if (typeof enable !== \"string\")\r\n await this.run(enable);\r\n\r\n return true;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ProjectExtents.js","sourceRoot":"","sources":["../../../src/tools/ProjectExtents.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,oDAA4E;AAC5E,wDAAuG;AACvG,+CAA4C;AAE5C,YAAY;AACZ,MAAa,wBAAwB;IAKnC,YAAmB,MAAwB;QAuB3C,0HAA0H;QAC1G,yBAAoB,GAAG,IAAI,CAAC;QAvB1C,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,cAAc,CAAC;QACtC,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAES,IAAI,KAAW,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAEtD,wBAAwB,CAAC,GAAY;QAC7C,IAAI,IAAI,CAAC,yBAAyB,EAAE;YAClC,IAAI,CAAC,GAAG,EAAE;gBACR,IAAI,CAAC,yBAAyB,EAAE,CAAC;gBACjC,IAAI,CAAC,yBAAyB,GAAG,SAAS,CAAC;aAC5C;SACF;aAAM,IA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,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;;AAtBH,4DAuBC;AAtBwB,+BAAM,GAAG,sBAAsB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Tools\r\n */\r\n\r\nimport { AxisAlignedBox3d, ColorDef, LinePixels } from \"@itwin/core-common\";\r\nimport { DecorateContext, GraphicType, IModelApp, IModelConnection, Tool } from \"@itwin/core-frontend\";\r\nimport { parseToggle } from \"./parseToggle\";\r\n\r\n/** @beta */\r\nexport class ProjectExtentsDecoration {\r\n private static _decorator?: ProjectExtentsDecoration;\r\n protected _removeDecorationListener?: () => void;\r\n protected _extents: AxisAlignedBox3d;\r\n\r\n public constructor(iModel: IModelConnection) {\r\n this._extents = iModel.projectExtents;\r\n this.updateDecorationListener(true);\r\n }\r\n\r\n protected stop(): void { this.updateDecorationListener(false); }\r\n\r\n protected updateDecorationListener(add: boolean): void {\r\n if (this._removeDecorationListener) {\r\n if (!add) {\r\n this._removeDecorationListener();\r\n this._removeDecorationListener = undefined;\r\n }\r\n } else if (add) {\r\n if (!this._removeDecorationListener)\r\n this._removeDecorationListener = IModelApp.viewManager.addDecorator(this);\r\n }\r\n }\r\n\r\n public static get isActive(): boolean {\r\n return undefined !== ProjectExtentsDecoration._decorator;\r\n }\r\n\r\n /** This will allow the render system to cache and reuse the decorations created by this decorator's decorate() method. */\r\n public readonly useCachedDecorations = true;\r\n\r\n public decorate(context: DecorateContext): void {\r\n const vp = context.viewport;\r\n if (!vp.view.isSpatialView())\r\n return;\r\n\r\n const builderAccVis = context.createGraphicBuilder(GraphicType.WorldDecoration);\r\n const builderAccHid = context.createGraphicBuilder(GraphicType.WorldOverlay);\r\n const colorAccVis = ColorDef.white.adjustedForContrast(context.viewport.view.backgroundColor);\r\n const colorAccHid = colorAccVis.withAlpha(100);\r\n\r\n builderAccVis.setSymbology(colorAccVis, ColorDef.black, 3);\r\n builderAccHid.setSymbology(colorAccHid, ColorDef.black, 1, LinePixels.Code2);\r\n\r\n builderAccVis.addRangeBox(this._extents);\r\n builderAccHid.addRangeBox(this._extents);\r\n\r\n context.addDecorationFromBuilder(builderAccVis);\r\n context.addDecorationFromBuilder(builderAccHid);\r\n }\r\n\r\n // Returns true if extents become enabled.\r\n public static toggle(imodel: IModelConnection, enabled?: boolean): boolean {\r\n if (undefined !== enabled) {\r\n const alreadyEnabled = undefined !== ProjectExtentsDecoration._decorator;\r\n if (enabled === alreadyEnabled)\r\n return alreadyEnabled;\r\n }\r\n\r\n if (undefined === ProjectExtentsDecoration._decorator) {\r\n ProjectExtentsDecoration._decorator = new ProjectExtentsDecoration(imodel);\r\n return true;\r\n } else {\r\n ProjectExtentsDecoration._decorator.stop();\r\n ProjectExtentsDecoration._decorator = undefined;\r\n return false;\r\n }\r\n }\r\n}\r\n\r\n/** Enable or disable the project extents decoration. This decoration draws a box coinciding with the iModel's project extents.\r\n * @param imodel The iModel from which to obtain the extents.\r\n * @param enable If undefined, the current enabled state of the decoration will be inverted; otherwise it will be enabled if true, or disabled if false.\r\n * @returns true if the extents are now ON, false if they are now OFF.\r\n * @beta\r\n */\r\nexport function toggleProjectExtents(imodel: IModelConnection, enabled?: boolean): boolean {\r\n return ProjectExtentsDecoration.toggle(imodel, enabled);\r\n}\r\n\r\n/** Enable or disable project extents decoration.\r\n * The key-in takes at most 1 argument (case-insensitive):\r\n * - \"ON\" => enable project extents\r\n * - \"OFF\" => disable project extents\r\n * - \"TOGGLE\" or omitted => toggle project extents\r\n * @see [toggleProjectExtents]\r\n * @beta\r\n */\r\nexport class ToggleProjectExtentsTool extends Tool {\r\n public static override toolId = \"ToggleProjectExtents\";\r\n public static override get minArgs() { return 0; }\r\n public static override get maxArgs() { return 1; }\r\n\r\n public override async run(enable?: boolean): Promise<boolean> {\r\n const vp = IModelApp.viewManager.selectedView;\r\n if (undefined !== vp && vp.view.isSpatialView()) {\r\n const iModel = vp.iModel;\r\n if (toggleProjectExtents(iModel, enable))\r\n vp.onChangeView.addOnce(() => toggleProjectExtents(iModel, false));\r\n }\r\n\r\n return true;\r\n }\r\n\r\n public override async parseAndRun(...args: string[]): Promise<boolean> {\r\n const enable = parseToggle(args[0]);\r\n if (typeof enable !== \"string\")\r\n await this.run(enable);\r\n\r\n return true;\r\n }\r\n}\r\n"]}
@@ -11,6 +11,7 @@ export declare class ProjectExtentsDecoration {
11
11
  constructor(iModel: IModelConnection);
12
12
  protected stop(): void;
13
13
  protected updateDecorationListener(add: boolean): void;
14
+ static get isActive(): boolean;
14
15
  /** This will allow the render system to cache and reuse the decorations created by this decorator's decorate() method. */
15
16
  readonly useCachedDecorations = true;
16
17
  decorate(context: DecorateContext): void;
@@ -1 +1 @@
1
- {"version":3,"file":"ProjectExtents.d.ts","sourceRoot":"","sources":["../../../src/tools/ProjectExtents.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAwB,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,eAAe,EAA0B,gBAAgB,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAGvG,YAAY;AACZ,qBAAa,wBAAwB;IACnC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAA2B;IACrD,SAAS,CAAC,yBAAyB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjD,SAAS,CAAC,QAAQ,EAAE,gBAAgB,CAAC;gBAElB,MAAM,EAAE,gBAAgB;IAK3C,SAAS,CAAC,I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kB,QAAQ,IAAI,OAAO,CAEpC;IAED,0HAA0H;IAC1H,SAAgB,oBAAoB,QAAQ;IAErC,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;WAqBjC,MAAM,CAAC,MAAM,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO;CAgB3E;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAEzF;AAED;;;;;;;GAOG;AACH,qBAAa,wBAAyB,SAAQ,IAAI;IAChD,OAAuB,MAAM,SAA0B;IACvD,WAA2B,OAAO,WAAgB;IAClD,WAA2B,OAAO,WAAgB;IAE5B,GAAG,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAWvC,WAAW,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;CAOvE"}
@@ -29,6 +29,9 @@ export class ProjectExtentsDecoration {
29
29
  this._removeDecorationListener = IModelApp.viewManager.addDecorator(this);
30
30
  }
31
31
  }
32
+ static get isActive() {
33
+ return undefined !== ProjectExtentsDecoration._decorator;
34
+ }
32
35
  decorate(context) {
33
36
  const vp = context.viewport;
34
37
  if (!vp.view.isSpatialView())
@@ -1 +1 @@
1
- {"version":3,"file":"ProjectExtents.js","sourceRoot":"","sources":["../../../src/tools/ProjectExtents.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAoB,QAAQ,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAmB,WAAW,EAAE,SAAS,EAAoB,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACvG,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,YAAY;AACZ,MAAM,OAAO,wBAAwB;IAKnC,YAAmB,MAAwB;QAmB3C,0HAA0H;Q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QAC9C,IAAI,SAAS,KAAK,EAAE,IAAI,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE;YAC/C,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC;YACzB,IAAI,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC;gBACtC,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,oBAAoB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;SACtE;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAEe,KAAK,CAAC,WAAW,CAAC,GAAG,IAAc;QACjD,MAAM,MAAM,GAAG,WAAW,CAAC,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;;AArBsB,+BAAM,GAAG,sBAAsB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Tools\r\n */\r\n\r\nimport { AxisAlignedBox3d, ColorDef, LinePixels } from \"@itwin/core-common\";\r\nimport { DecorateContext, GraphicType, IModelApp, IModelConnection, Tool } from \"@itwin/core-frontend\";\r\nimport { parseToggle } from \"./parseToggle\";\r\n\r\n/** @beta */\r\nexport class ProjectExtentsDecoration {\r\n private static _decorator?: ProjectExtentsDecoration;\r\n protected _removeDecorationListener?: () => void;\r\n protected _extents: AxisAlignedBox3d;\r\n\r\n public constructor(iModel: IModelConnection) {\r\n this._extents = iModel.projectExtents;\r\n this.updateDecorationListener(true);\r\n }\r\n\r\n protected stop(): void { this.updateDecorationListener(false); }\r\n\r\n protected updateDecorationListener(add: boolean): void {\r\n if (this._removeDecorationListener) {\r\n if (!add) {\r\n this._removeDecorationListener();\r\n this._removeDecorationListener = undefined;\r\n }\r\n } else if (add) {\r\n if (!this._removeDecorationListener)\r\n this._removeDecorationListener = IModelApp.viewManager.addDecorator(this);\r\n }\r\n }\r\n\r\n /** This will allow the render system to cache and reuse the decorations created by this decorator's decorate() method. */\r\n public readonly useCachedDecorations = true;\r\n\r\n public decorate(context: DecorateContext): void {\r\n const vp = context.viewport;\r\n if (!vp.view.isSpatialView())\r\n return;\r\n\r\n const builderAccVis = context.createGraphicBuilder(GraphicType.WorldDecoration);\r\n const builderAccHid = context.createGraphicBuilder(GraphicType.WorldOverlay);\r\n const colorAccVis = ColorDef.white.adjustedForContrast(context.viewport.view.backgroundColor);\r\n const colorAccHid = colorAccVis.withAlpha(100);\r\n\r\n builderAccVis.setSymbology(colorAccVis, ColorDef.black, 3);\r\n builderAccHid.setSymbology(colorAccHid, ColorDef.black, 1, LinePixels.Code2);\r\n\r\n builderAccVis.addRangeBox(this._extents);\r\n builderAccHid.addRangeBox(this._extents);\r\n\r\n context.addDecorationFromBuilder(builderAccVis);\r\n context.addDecorationFromBuilder(builderAccHid);\r\n }\r\n\r\n // Returns true if extents become enabled.\r\n public static toggle(imodel: IModelConnection, enabled?: boolean): boolean {\r\n if (undefined !== enabled) {\r\n const alreadyEnabled = undefined !== ProjectExtentsDecoration._decorator;\r\n if (enabled === alreadyEnabled)\r\n return alreadyEnabled;\r\n }\r\n\r\n if (undefined === ProjectExtentsDecoration._decorator) {\r\n ProjectExtentsDecoration._decorator = new ProjectExtentsDecoration(imodel);\r\n return true;\r\n } else {\r\n ProjectExtentsDecoration._decorator.stop();\r\n ProjectExtentsDecoration._decorator = undefined;\r\n return false;\r\n }\r\n }\r\n}\r\n\r\n/** Enable or disable the project extents decoration. This decoration draws a box coinciding with the iModel's project extents.\r\n * @param imodel The iModel from which to obtain the extents.\r\n * @param enable If undefined, the current enabled state of the decoration will be inverted; otherwise it will be enabled if true, or disabled if false.\r\n * @returns true if the extents are now ON, false if they are now OFF.\r\n * @beta\r\n */\r\nexport function toggleProjectExtents(imodel: IModelConnection, enabled?: boolean): boolean {\r\n return ProjectExtentsDecoration.toggle(imodel, enabled);\r\n}\r\n\r\n/** Enable or disable project extents decoration.\r\n * The key-in takes at most 1 argument (case-insensitive):\r\n * - \"ON\" => enable project extents\r\n * - \"OFF\" => disable project extents\r\n * - \"TOGGLE\" or omitted => toggle project extents\r\n * @see [toggleProjectExtents]\r\n * @beta\r\n */\r\nexport class ToggleProjectExtentsTool extends Tool {\r\n public static override toolId = \"ToggleProjectExtents\";\r\n public static override get minArgs() { return 0; }\r\n public static override get maxArgs() { return 1; }\r\n\r\n public override async run(enable?: boolean): Promise<boolean> {\r\n const vp = IModelApp.viewManager.selectedView;\r\n if (undefined !== vp && vp.view.isSpatialView()) {\r\n const iModel = vp.iModel;\r\n if (toggleProjectExtents(iModel, enable))\r\n vp.onChangeView.addOnce(() => toggleProjectExtents(iModel, false));\r\n }\r\n\r\n return true;\r\n }\r\n\r\n public override async parseAndRun(...args: string[]): Promise<boolean> {\r\n const enable = parseToggle(args[0]);\r\n if (typeof enable !== \"string\")\r\n await this.run(enable);\r\n\r\n return true;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ProjectExtents.js","sourceRoot":"","sources":["../../../src/tools/ProjectExtents.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAoB,QAAQ,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAmB,WAAW,EAAE,SAAS,EAAoB,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACvG,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,YAAY;AACZ,MAAM,OAAO,wBAAwB;IAKnC,YAAmB,MAAwB;QAuB3C,0HAA0H;QAC1G,yBAAoB,GAAG,IAAI,CAAC;QAvB1C,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,cAAc,CAAC;QACtC,IAA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I,SAAS,KAAK,EAAE,IAAI,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE;YAC/C,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC;YACzB,IAAI,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC;gBACtC,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,oBAAoB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;SACtE;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAEe,KAAK,CAAC,WAAW,CAAC,GAAG,IAAc;QACjD,MAAM,MAAM,GAAG,WAAW,CAAC,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;;AArBsB,+BAAM,GAAG,sBAAsB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Tools\r\n */\r\n\r\nimport { AxisAlignedBox3d, ColorDef, LinePixels } from \"@itwin/core-common\";\r\nimport { DecorateContext, GraphicType, IModelApp, IModelConnection, Tool } from \"@itwin/core-frontend\";\r\nimport { parseToggle } from \"./parseToggle\";\r\n\r\n/** @beta */\r\nexport class ProjectExtentsDecoration {\r\n private static _decorator?: ProjectExtentsDecoration;\r\n protected _removeDecorationListener?: () => void;\r\n protected _extents: AxisAlignedBox3d;\r\n\r\n public constructor(iModel: IModelConnection) {\r\n this._extents = iModel.projectExtents;\r\n this.updateDecorationListener(true);\r\n }\r\n\r\n protected stop(): void { this.updateDecorationListener(false); }\r\n\r\n protected updateDecorationListener(add: boolean): void {\r\n if (this._removeDecorationListener) {\r\n if (!add) {\r\n this._removeDecorationListener();\r\n this._removeDecorationListener = undefined;\r\n }\r\n } else if (add) {\r\n if (!this._removeDecorationListener)\r\n this._removeDecorationListener = IModelApp.viewManager.addDecorator(this);\r\n }\r\n }\r\n\r\n public static get isActive(): boolean {\r\n return undefined !== ProjectExtentsDecoration._decorator;\r\n }\r\n\r\n /** This will allow the render system to cache and reuse the decorations created by this decorator's decorate() method. */\r\n public readonly useCachedDecorations = true;\r\n\r\n public decorate(context: DecorateContext): void {\r\n const vp = context.viewport;\r\n if (!vp.view.isSpatialView())\r\n return;\r\n\r\n const builderAccVis = context.createGraphicBuilder(GraphicType.WorldDecoration);\r\n const builderAccHid = context.createGraphicBuilder(GraphicType.WorldOverlay);\r\n const colorAccVis = ColorDef.white.adjustedForContrast(context.viewport.view.backgroundColor);\r\n const colorAccHid = colorAccVis.withAlpha(100);\r\n\r\n builderAccVis.setSymbology(colorAccVis, ColorDef.black, 3);\r\n builderAccHid.setSymbology(colorAccHid, ColorDef.black, 1, LinePixels.Code2);\r\n\r\n builderAccVis.addRangeBox(this._extents);\r\n builderAccHid.addRangeBox(this._extents);\r\n\r\n context.addDecorationFromBuilder(builderAccVis);\r\n context.addDecorationFromBuilder(builderAccHid);\r\n }\r\n\r\n // Returns true if extents become enabled.\r\n public static toggle(imodel: IModelConnection, enabled?: boolean): boolean {\r\n if (undefined !== enabled) {\r\n const alreadyEnabled = undefined !== ProjectExtentsDecoration._decorator;\r\n if (enabled === alreadyEnabled)\r\n return alreadyEnabled;\r\n }\r\n\r\n if (undefined === ProjectExtentsDecoration._decorator) {\r\n ProjectExtentsDecoration._decorator = new ProjectExtentsDecoration(imodel);\r\n return true;\r\n } else {\r\n ProjectExtentsDecoration._decorator.stop();\r\n ProjectExtentsDecoration._decorator = undefined;\r\n return false;\r\n }\r\n }\r\n}\r\n\r\n/** Enable or disable the project extents decoration. This decoration draws a box coinciding with the iModel's project extents.\r\n * @param imodel The iModel from which to obtain the extents.\r\n * @param enable If undefined, the current enabled state of the decoration will be inverted; otherwise it will be enabled if true, or disabled if false.\r\n * @returns true if the extents are now ON, false if they are now OFF.\r\n * @beta\r\n */\r\nexport function toggleProjectExtents(imodel: IModelConnection, enabled?: boolean): boolean {\r\n return ProjectExtentsDecoration.toggle(imodel, enabled);\r\n}\r\n\r\n/** Enable or disable project extents decoration.\r\n * The key-in takes at most 1 argument (case-insensitive):\r\n * - \"ON\" => enable project extents\r\n * - \"OFF\" => disable project extents\r\n * - \"TOGGLE\" or omitted => toggle project extents\r\n * @see [toggleProjectExtents]\r\n * @beta\r\n */\r\nexport class ToggleProjectExtentsTool extends Tool {\r\n public static override toolId = \"ToggleProjectExtents\";\r\n public static override get minArgs() { return 0; }\r\n public static override get maxArgs() { return 1; }\r\n\r\n public override async run(enable?: boolean): Promise<boolean> {\r\n const vp = IModelApp.viewManager.selectedView;\r\n if (undefined !== vp && vp.view.isSpatialView()) {\r\n const iModel = vp.iModel;\r\n if (toggleProjectExtents(iModel, enable))\r\n vp.onChangeView.addOnce(() => toggleProjectExtents(iModel, false));\r\n }\r\n\r\n return true;\r\n }\r\n\r\n public override async parseAndRun(...args: string[]): Promise<boolean> {\r\n const enable = parseToggle(args[0]);\r\n if (typeof enable !== \"string\")\r\n await this.run(enable);\r\n\r\n return true;\r\n }\r\n}\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/frontend-devtools",
3
- "version": "3.3.0-dev.24",
3
+ "version": "3.3.0-dev.27",
4
4
  "description": "Debug menu and supporting UI widgets",
5
5
  "main": "lib/cjs/frontend-devtools.js",
6
6
  "module": "lib/esm/frontend-devtools.js",
@@ -22,15 +22,15 @@
22
22
  "url": "http://www.bentley.com"
23
23
  },
24
24
  "dependencies": {
25
- "@itwin/core-bentley": "3.3.0-dev.24",
26
- "@itwin/core-common": "3.3.0-dev.24",
27
- "@itwin/core-frontend": "3.3.0-dev.24",
28
- "@itwin/core-geometry": "3.3.0-dev.24",
25
+ "@itwin/core-bentley": "3.3.0-dev.27",
26
+ "@itwin/core-common": "3.3.0-dev.27",
27
+ "@itwin/core-frontend": "3.3.0-dev.27",
28
+ "@itwin/core-geometry": "3.3.0-dev.27",
29
29
  "file-saver": "^2.0.2"
30
30
  },
31
31
  "devDependencies": {
32
- "@itwin/build-tools": "3.3.0-dev.24",
33
- "@itwin/eslint-plugin": "3.3.0-dev.24",
32
+ "@itwin/build-tools": "3.3.0-dev.27",
33
+ "@itwin/eslint-plugin": "3.3.0-dev.27",
34
34
  "@types/file-saver": "^2.0.1",
35
35
  "@types/node": "16.11.7",
36
36
  "cpx2": "^3.0.0",