@itwin/hypermodeling-frontend 4.2.0-dev.9 → 4.3.0-dev.0
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 +36 -1
- package/lib/cjs/HyperModelingDecorator.js +1 -1
- package/lib/cjs/HyperModelingDecorator.js.map +1 -1
- package/lib/cjs/PopupToolbar.js +1 -1
- package/lib/cjs/PopupToolbar.js.map +1 -1
- package/lib/esm/HyperModelingDecorator.js +1 -1
- package/lib/esm/HyperModelingDecorator.js.map +1 -1
- package/lib/esm/PopupToolbar.js +1 -1
- package/lib/esm/PopupToolbar.js.map +1 -1
- package/package.json +13 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
# Change Log - @itwin/hypermodeling-frontend
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 29 Sep 2023 18:24:48 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 4.1.7
|
|
6
|
+
Thu, 28 Sep 2023 21:41:33 GMT
|
|
7
|
+
|
|
8
|
+
_Version update only_
|
|
9
|
+
|
|
10
|
+
## 4.1.6
|
|
11
|
+
Tue, 12 Sep 2023 15:38:52 GMT
|
|
12
|
+
|
|
13
|
+
_Version update only_
|
|
14
|
+
|
|
15
|
+
## 4.1.5
|
|
16
|
+
Fri, 08 Sep 2023 13:37:23 GMT
|
|
17
|
+
|
|
18
|
+
_Version update only_
|
|
19
|
+
|
|
20
|
+
## 4.1.4
|
|
21
|
+
Thu, 07 Sep 2023 18:26:02 GMT
|
|
22
|
+
|
|
23
|
+
_Version update only_
|
|
24
|
+
|
|
25
|
+
## 4.1.3
|
|
26
|
+
Wed, 30 Aug 2023 15:35:27 GMT
|
|
27
|
+
|
|
28
|
+
_Version update only_
|
|
29
|
+
|
|
30
|
+
## 4.1.2
|
|
31
|
+
Wed, 23 Aug 2023 15:25:30 GMT
|
|
32
|
+
|
|
33
|
+
_Version update only_
|
|
4
34
|
|
|
5
35
|
## 4.1.1
|
|
6
36
|
Fri, 18 Aug 2023 13:02:53 GMT
|
|
@@ -56,6 +86,11 @@ Mon, 22 May 2023 15:34:14 GMT
|
|
|
56
86
|
|
|
57
87
|
- Update to eslint@8
|
|
58
88
|
|
|
89
|
+
## 3.7.14
|
|
90
|
+
Fri, 29 Sep 2023 16:57:16 GMT
|
|
91
|
+
|
|
92
|
+
_Version update only_
|
|
93
|
+
|
|
59
94
|
## 3.7.13
|
|
60
95
|
Tue, 08 Aug 2023 19:49:18 GMT
|
|
61
96
|
|
|
@@ -35,7 +35,7 @@ class MarkerToolbarProvider {
|
|
|
35
35
|
return this.marker.isHilited;
|
|
36
36
|
}
|
|
37
37
|
get toolbarLocation() {
|
|
38
|
-
return
|
|
38
|
+
return { x: this.marker.rect.right, y: this.marker.rect.top };
|
|
39
39
|
}
|
|
40
40
|
get htmlElement() {
|
|
41
41
|
return this._viewport.canvas;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HyperModelingDecorator.js","sourceRoot":"","sources":["../../src/HyperModelingDecorator.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,wDAAwD;AAExD,wDAE8B;AAC9B,qDAAmE;AACnE,+EAA4E;AAC5E,uEAA0E;AAC1E,iDAA2E;AAC3E,mDAAgD;AAGhD,KAAK,UAAU,aAAa,CAAC,EAAkB;IAC7C,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE;QAC1B,OAAO,SAAS,CAAC;IAEnB,MAAM,MAAM,GAAG,MAAM,yDAA2B,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;IACrE,IAAI,CAAC,KAAK,MAAM,CAAC,MAAM;QACrB,OAAO,SAAS,CAAC;IAEnB,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,8BAAa,CAAC,K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tB,qBAAqB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;SAC1C;IACH,CAAC;IAEO,IAAI;QACV,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,IAAI,6BAAa,CAAC,aAAa,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC,sBAAsB,EAAE,EAAE;YAC7F,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;YACzB,IAAI,CAAC,QAAQ,CAAC,2BAA2B,CAAC,IAAI,CAAC,CAAC;SACjD;IACH,CAAC;IAEO,eAAe,CAAC,MAAqB;QAC3C,IAAI,SAAS,KAAK,IAAI,CAAC,YAAY;YACjC,OAAO,MAAM,KAAK,IAAI,CAAC,YAAY,CAAC;QAEtC,OAAO,6BAAa,CAAC,aAAa,CAAC,eAAe,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACjF,CAAC;IAEO,sBAAsB;QAC5B,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACzC,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC;YAClC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YAC9C,OAAO,GAAG,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC;SACtD;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA7VD,wDA6VC","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/** @packageDocumentation\r\n * @module HyperModeling\r\n */\r\n\r\nimport { Transform, XAndY } from \"@itwin/core-geometry\";\r\nimport type { AbstractToolbarProps } from \"@itwin/appui-abstract\";\r\nimport {\r\n ChangeFlags, DecorateContext, Decorator, IModelApp, IModelConnection, ScreenViewport, SpatialViewState, TiledGraphicsProvider, ViewClipTool,\r\n} from \"@itwin/core-frontend\";\r\nimport { SectionMarker, SectionMarkerSet } from \"./SectionMarkers\";\r\nimport { SectionDrawingLocationState } from \"./SectionDrawingLocationState\";\r\nimport { createSectionGraphicsProvider } from \"./SectionGraphicsProvider\";\r\nimport { PopupToolbarManager, PopupToolbarProvider } from \"./PopupToolbar\";\r\nimport { HyperModeling } from \"./HyperModeling\";\r\nimport { SectionMarkerConfig } from \"./HyperModelingConfig\";\r\n\r\nasync function createMarkers(vp: ScreenViewport): Promise<SectionMarkerSet | undefined> {\r\n if (!vp.view.isSpatialView())\r\n return undefined;\r\n\r\n const states = await SectionDrawingLocationState.queryAll(vp.iModel);\r\n if (0 === states.length)\r\n return undefined;\r\n\r\n const markers = states.map((state) => new SectionMarker(state));\r\n return new SectionMarkerSet(vp, markers);\r\n}\r\n\r\nclass MarkerToolbarProvider implements PopupToolbarProvider {\r\n private readonly _viewport: ScreenViewport;\r\n public readonly marker: SectionMarker;\r\n public readonly toolbarProps: AbstractToolbarProps;\r\n public readonly onToolbarItemExecuted: (id: string) => void;\r\n\r\n public constructor(marker: SectionMarker, decorator: HyperModelingDecorator) {\r\n this.marker = marker;\r\n this._viewport = decorator.viewport;\r\n this.toolbarProps = HyperModeling.markerHandler.getToolbarProps(marker, decorator);\r\n this.onToolbarItemExecuted = (id) => HyperModeling.markerHandler.executeCommand(id, marker, decorator); // eslint-disable-line @typescript-eslint/promise-function-async\r\n }\r\n\r\n public get overToolbarHotspot() {\r\n return this.marker.isHilited;\r\n }\r\n\r\n public get toolbarLocation(): XAndY {\r\n return IModelApp.uiAdmin.createXAndY(this.marker.rect.right, this.marker.rect.top);\r\n }\r\n\r\n public get htmlElement() {\r\n return this._viewport.canvas;\r\n }\r\n}\r\n\r\n/** A [Decorator]($frontend) that displays a [[SectionMarker]] for each [SectionDrawingLocation]($backend) in the view.\r\n * Clicking on a marker toggles the section and the display of associated 2d graphics.\r\n * Hovering over a marker opens a mini toolbar with additional interactions.\r\n * @see [[SectionMarkerHandler]] to customize the marker interactions.\r\n * @see [[HyperModeling.startOrStop]] to enable or disable the decorator for a viewport.\r\n * @public\r\n */\r\nexport class HyperModelingDecorator implements Decorator {\r\n /** The set of [[SectionMarker]]s controlled by this decorator. */\r\n public readonly markers: SectionMarkerSet;\r\n private _config: SectionMarkerConfig;\r\n private readonly _removeEventListeners = new Array<() => void>();\r\n private readonly _iModel: IModelConnection;\r\n private _needSync = false;\r\n private _toolbarProvider?: MarkerToolbarProvider;\r\n private _tiledGraphicsProvider?: TiledGraphicsProvider;\r\n private _activeMarker?: SectionMarker;\r\n private _appliedSpatialView?: SpatialViewState;\r\n /** @internal */\r\n public syncImmediately = false;\r\n\r\n /** Create a new decorator and register it with the [ViewManager]($frontend). Typically invoked indirectly via [[HyperModeling.startOrStop]]. */\r\n public static async create(vp: ScreenViewport, config: SectionMarkerConfig): Promise<HyperModelingDecorator | undefined> {\r\n const markers = await createMarkers(vp);\r\n return undefined !== markers ? new HyperModelingDecorator(markers, config) : undefined;\r\n }\r\n\r\n /** Obtain the decorator associated with the specified viewport, if any. */\r\n public static getForViewport(vp: ScreenViewport): HyperModelingDecorator | undefined {\r\n for (const decorator of IModelApp.viewManager.decorators)\r\n if (decorator instanceof HyperModelingDecorator && decorator.viewport === vp)\r\n return decorator;\r\n\r\n return undefined;\r\n }\r\n\r\n /** The viewport into which this decorator draws its [[SectionMarker]]s. */\r\n public get viewport(): ScreenViewport {\r\n return this.markers.viewport;\r\n }\r\n\r\n /** The currently active marker. A marker typically becomes active when the user clicks on it.\r\n * @see [[setActiveMarker]] to change the active marker without user interaction.\r\n */\r\n public get activeMarker(): SectionMarker | undefined {\r\n return this._activeMarker;\r\n }\r\n\r\n /** @internal */\r\n public get config(): SectionMarkerConfig {\r\n return this._config;\r\n }\r\n\r\n /** Replaces the current marker display configuration, overwriting all previous settings. Passing `undefined` resets all settings to defaults.\r\n * @see [[updateConfiguration]] to override specific aspects of the configuration\r\n * @see [[HyperModeling.replaceConfiguration]] to replace the global configuration.\r\n */\r\n public replaceConfiguration(config?: SectionMarkerConfig): void {\r\n this._config = config ? { ...config } : {};\r\n this.requestSync();\r\n }\r\n\r\n /** Overrides specific aspects of the current marker display configuration.\r\n * Any field that is not `undefined` will be replaced in the current configuration; the rest will retain their current values.\r\n * @see [[replaceConfiguration]] to override all settings.\r\n * @see [[HyperModeling.updateConfiguration]] to update the global configuration.\r\n */\r\n public updateConfiguration(config: SectionMarkerConfig): void {\r\n this._config = {\r\n ignoreModelSelector: config.ignoreModelSelector ?? this._config.ignoreModelSelector,\r\n ignoreCategorySelector: config.ignoreCategorySelector ?? this._config.ignoreCategorySelector,\r\n hiddenSectionTypes: config.hiddenSectionTypes ?? this._config.hiddenSectionTypes,\r\n };\r\n\r\n this.requestSync();\r\n }\r\n\r\n /** Sets the currently active marker. This function is invoked when the user clicks on a marker, but may also be called manually to produce the same result.\r\n * Changing the active marker first deactivates the currently active marker, if any; then activates the specified marker, if supplied.\r\n * Returns false if marker activation fails.\r\n * @see [[activeMarker]] to obtain the currently active section marker.\r\n * @see [[SectionMarkerHandler.activateMarker]] to control what happens when a marker is activated.\r\n * @see [[SectionMarkerHandler.deactivateMarker]] to control what happens when a marker is deactivated.\r\n */\r\n public async setActiveMarker(marker: SectionMarker | undefined): Promise<boolean> {\r\n if (marker === this.activeMarker)\r\n return true;\r\n\r\n if (this.activeMarker) {\r\n this.activeMarker.setActive(false);\r\n await HyperModeling.markerHandler.deactivateMarker(this.activeMarker, this);\r\n this._activeMarker = undefined;\r\n }\r\n\r\n if (marker) {\r\n if (!await HyperModeling.markerHandler.activateMarker(marker, this)) {\r\n this.requestSync();\r\n return false;\r\n }\r\n\r\n marker.setActive(true);\r\n this._activeMarker = marker;\r\n }\r\n\r\n this.requestSync();\r\n return true;\r\n }\r\n\r\n /** @internal */\r\n public readonly useCachedDecorations = true;\r\n\r\n /** @internal */\r\n public decorate(context: DecorateContext): void {\r\n if (this.viewport.view.is3d())\r\n this.markers.addDecoration(context);\r\n }\r\n\r\n private constructor(markers: SectionMarkerSet, config: SectionMarkerConfig) {\r\n this.markers = markers;\r\n this._config = { ...config };\r\n this._iModel = this.viewport.iModel;\r\n\r\n this.viewport.onChangeView.addOnce(() => {\r\n this.requestSync();\r\n });\r\n\r\n this._removeEventListeners.push(this.viewport.onViewportChanged.addListener((_, changeFlags) => this.onViewportChanged(changeFlags)));\r\n this._removeEventListeners.push(this.viewport.onDisposed.addListener(() => this.dispose()));\r\n\r\n for (const marker of markers.markers) {\r\n marker.onMouseEnterEvent.addListener((mkr) => this.showToolbarAfterTimeout(mkr));\r\n marker.onMouseButtonEvent.addListener((mkr) => this.toggleMarker(mkr)); // eslint-disable-line @typescript-eslint/promise-function-async\r\n }\r\n\r\n this.updateMarkerVisibility();\r\n IModelApp.viewManager.addDecorator(this);\r\n }\r\n\r\n private onViewportChanged(changeFlags: ChangeFlags): void {\r\n if (this.viewport.iModel !== this._iModel) {\r\n this.dispose();\r\n return;\r\n }\r\n\r\n if (changeFlags.viewedCategories || changeFlags.viewedModels || changeFlags.viewedCategoriesPerModel)\r\n this.requestSync();\r\n\r\n if (changeFlags.viewState) {\r\n // If we're looking at a different view now, and we did not initiate that, turn off the active marker.\r\n if (this.viewport.view !== this._appliedSpatialView)\r\n this.setActiveMarker(undefined); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n else\r\n this._appliedSpatialView = undefined;\r\n }\r\n }\r\n\r\n private async toggleMarker(marker: SectionMarker): Promise<void> {\r\n await this.setActiveMarker(marker === this.activeMarker ? undefined : marker);\r\n }\r\n\r\n private dropTiledGraphicsProvider(): void {\r\n if (undefined === this._tiledGraphicsProvider)\r\n return;\r\n\r\n this.viewport.dropTiledGraphicsProvider(this._tiledGraphicsProvider);\r\n this._tiledGraphicsProvider = undefined;\r\n }\r\n\r\n /** @internal */\r\n public dispose(): void {\r\n if (!IModelApp.viewManager.dropDecorator(this))\r\n return;\r\n\r\n for (const remove of this._removeEventListeners)\r\n remove();\r\n\r\n this.dropTiledGraphicsProvider();\r\n }\r\n\r\n private showToolbarAfterTimeout(marker: SectionMarker): void {\r\n if (this._toolbarProvider?.marker !== marker)\r\n this._toolbarProvider = new MarkerToolbarProvider(marker, this);\r\n\r\n PopupToolbarManager.showToolbarAfterTimeout(this._toolbarProvider);\r\n }\r\n\r\n /** Toggles whether the clip volume associated with the specified marker is applied to the view. */\r\n public toggleClipVolume(marker: SectionMarker, enable: boolean): void {\r\n ViewClipTool.enableClipVolume(this.viewport);\r\n ViewClipTool.setViewClip(this.viewport, enable ? marker.state.clip : undefined);\r\n }\r\n\r\n /** Toggles the specified section marker.\r\n * Enabling the section applies the frustum and clip volume of the marker's spatial view to the viewport, and displays the 2d section graphics and sheet annotations.\r\n * Disabling the section disables the clip volume and 2d graphics.\r\n * @see [[toggleClipVolume]] to toggle only the clip volume.\r\n * @see [[toggleAttachment]] to toggle only the attachment graphics.\r\n */\r\n public async toggleSection(marker: SectionMarker, enable: boolean): Promise<boolean> {\r\n if (enable) {\r\n if (this.viewport.view.is3d()) {\r\n // Preserve the view settings; apply only the frustum and clip volume\r\n const spatialView = await marker.state.tryLoadSpatialView();\r\n if (!spatialView)\r\n return false;\r\n\r\n const aligned = await this.alignToSpatialView(marker);\r\n if (!aligned)\r\n return false;\r\n\r\n this.toggleClipVolume(marker, true);\r\n } else if (!await this.applySpatialView(marker)) {\r\n return false;\r\n }\r\n } else {\r\n this.toggleClipVolume(marker, false);\r\n }\r\n\r\n this.requestSync();\r\n return this.toggleAttachment(marker, enable);\r\n }\r\n\r\n /** Toggles display of 2d section graphics and sheet annotations for the specified marker.\r\n * @see [[toggleSection]] to apply the spatial view and clip volume in addition to the attachment graphics.\r\n */\r\n public async toggleAttachment(marker: SectionMarker, enable: boolean): Promise<boolean> {\r\n this.dropTiledGraphicsProvider();\r\n if (enable) {\r\n this._tiledGraphicsProvider = await createSectionGraphicsProvider(marker.state);\r\n this.viewport.addTiledGraphicsProvider(this._tiledGraphicsProvider);\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /** Aligns the viewport to face the specified marker's section plane. */\r\n public alignView(marker: SectionMarker): void {\r\n const placement = marker.state.placement.transform;\r\n const origin = placement.origin;\r\n const matrix = placement.matrix;\r\n\r\n const vp = this.viewport;\r\n const targetMatrix = matrix.multiplyMatrixMatrix(vp.rotation);\r\n const rotateTransform = Transform.createFixedPointAndMatrix(origin, targetMatrix);\r\n\r\n const startFrustum = vp.getFrustum();\r\n const newFrustum = startFrustum.clone();\r\n newFrustum.multiply(rotateTransform);\r\n\r\n if (startFrustum.equals(newFrustum))\r\n return;\r\n\r\n vp.view.setupFromFrustum(newFrustum);\r\n vp.synchWithView();\r\n vp.animateFrustumChange();\r\n }\r\n\r\n /** Opens the marker's drawing view in the decorator's viewport. Returns false if the drawing view could not be loaded. */\r\n public async openSection(marker: SectionMarker): Promise<boolean> {\r\n const viewState = await marker.state.tryLoadDrawingView();\r\n if (viewState)\r\n this.viewport.changeView(viewState);\r\n\r\n return undefined !== viewState;\r\n }\r\n\r\n /** Opens marker's sheet view in the decorator's viewport and zooms in on the associated [ViewAttachment]($backend). Returns false if no view\r\n * attachment exists or the sheet view could not be loaded.\r\n */\r\n public async openSheet(marker: SectionMarker): Promise<boolean> {\r\n if (undefined === marker.state.viewAttachment)\r\n return false;\r\n\r\n const viewState = await marker.state.tryLoadSheetView();\r\n if (!viewState)\r\n return false;\r\n\r\n this.viewport.changeView(viewState);\r\n await this.viewport.zoomToElements(marker.state.viewAttachment.id);\r\n return true;\r\n }\r\n\r\n /** Aligns the view to match the frustum of the spatial view associated with the specified marker.\r\n * @param marker The marker whose spatial view's frustum should be applied.\r\n * @returns false if the frustum could not be applied, e.g. because the spatial view could not be loaded or the viewport is viewing a 2d model.\r\n * @see [[alignView]] to align to the *section plane*, which may differ.\r\n * @see [[toggleSection]] to also apply the clip volume.\r\n */\r\n public async alignToSpatialView(marker: SectionMarker): Promise<boolean> {\r\n if (!this.viewport.view.is3d())\r\n return false;\r\n\r\n const spatialView = await marker.state.tryLoadSpatialView();\r\n if (!spatialView)\r\n return false;\r\n\r\n this.viewport.view.setOrigin(spatialView.getOrigin());\r\n this.viewport.view.setExtents(spatialView.getExtents());\r\n this.viewport.view.setRotation(spatialView.getRotation());\r\n this.viewport.synchWithView({ animateFrustumChange: true });\r\n\r\n return true;\r\n }\r\n\r\n /** Applies the marker's spatial view - including its clip volume - to the decorator's viewport.\r\n * Returns false if the spatial view could not be loaded.\r\n * @see [[toggleSection]].\r\n * @see [[toggleClipVolume]].\r\n */\r\n public async applySpatialView(marker: SectionMarker): Promise<boolean> {\r\n const viewState = await marker.state.tryLoadSpatialView();\r\n if (viewState) {\r\n this._appliedSpatialView = viewState;\r\n this.viewport.changeView(viewState);\r\n }\r\n\r\n return undefined !== viewState;\r\n }\r\n\r\n /** Request that the visibility of the section markers be recomputed. It is only necessary to call this if you have overridden [[SectionMarkerHandler.isMarkerVisible]]; if so, you should invoke\r\n * this method when the criteria governing your `isMarkerVisible` method have changed.\r\n */\r\n public requestSync(): void {\r\n if (this.syncImmediately) {\r\n this.sync();\r\n } else if (!this._needSync) {\r\n this._needSync = true;\r\n requestAnimationFrame(() => this.sync());\r\n }\r\n }\r\n\r\n private sync(): void {\r\n this._needSync = false;\r\n if (HyperModeling.isInitialized && this.viewport.view.is3d() && this.updateMarkerVisibility()) {\r\n this.markers.markDirty();\r\n this.viewport.invalidateCachedDecorations(this);\r\n }\r\n }\r\n\r\n private isMarkerVisible(marker: SectionMarker): boolean {\r\n if (undefined !== this.activeMarker)\r\n return marker === this.activeMarker;\r\n\r\n return HyperModeling.markerHandler.isMarkerVisible(marker, this, this._config);\r\n }\r\n\r\n private updateMarkerVisibility(): boolean {\r\n let changed = false;\r\n for (const marker of this.markers.markers) {\r\n const wasVisible = marker.visible;\r\n marker.visible = this.isMarkerVisible(marker);\r\n changed = changed || (marker.visible !== wasVisible);\r\n }\r\n\r\n return changed;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"HyperModelingDecorator.js","sourceRoot":"","sources":["../../src/HyperModelingDecorator.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,wDAAwD;AAExD,wDAE8B;AAC9B,qDAAmE;AACnE,+EAA4E;AAC5E,uEAA0E;AAC1E,iDAA2E;AAC3E,mDAAgD;AAGhD,KAAK,UAAU,aAAa,CAAC,EAAkB;IAC7C,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE;QAC1B,OAAO,SAAS,CAAC;IAEnB,MAAM,MAAM,GAAG,MAAM,yDAA2B,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;IACrE,IAAI,CAAC,KAAK,MAAM,CAAC,MAAM;QACrB,OAAO,SAAS,CAAC;IAEnB,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,8BAAa,CAAC,KAAK,CAAC,CAAC,CAAC;IAChE,OAAO,IAAI,iCAAgB,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC;AAED,MAAM,qBAAqB;IAMzB,YAAmB,MAAqB,EAAE,SAAiC;QACzE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,QAAQ,CAAC;QACpC,IAAI,CAAC,YAAY,GAAG,6BAAa,CAAC,aAAa,CAAC,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QACnF,IAAI,CAAC,qBAAqB,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,6BAAa,CAAC,aAAa,CAAC,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,gEAAgE;IAC1K,CAAC;IAED,IAAW,kBAAkB;QAC3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AAC,eAAe,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACjF,CAAC;IAEO,sBAAsB;QAC5B,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACzC,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC;YAClC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YAC9C,OAAO,GAAG,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC;SACtD;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA7VD,wDA6VC","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/** @packageDocumentation\r\n * @module HyperModeling\r\n */\r\n\r\nimport { Transform, XAndY } from \"@itwin/core-geometry\";\r\nimport type { AbstractToolbarProps } from \"@itwin/appui-abstract\";\r\nimport {\r\n ChangeFlags, DecorateContext, Decorator, IModelApp, IModelConnection, ScreenViewport, SpatialViewState, TiledGraphicsProvider, ViewClipTool,\r\n} from \"@itwin/core-frontend\";\r\nimport { SectionMarker, SectionMarkerSet } from \"./SectionMarkers\";\r\nimport { SectionDrawingLocationState } from \"./SectionDrawingLocationState\";\r\nimport { createSectionGraphicsProvider } from \"./SectionGraphicsProvider\";\r\nimport { PopupToolbarManager, PopupToolbarProvider } from \"./PopupToolbar\";\r\nimport { HyperModeling } from \"./HyperModeling\";\r\nimport { SectionMarkerConfig } from \"./HyperModelingConfig\";\r\n\r\nasync function createMarkers(vp: ScreenViewport): Promise<SectionMarkerSet | undefined> {\r\n if (!vp.view.isSpatialView())\r\n return undefined;\r\n\r\n const states = await SectionDrawingLocationState.queryAll(vp.iModel);\r\n if (0 === states.length)\r\n return undefined;\r\n\r\n const markers = states.map((state) => new SectionMarker(state));\r\n return new SectionMarkerSet(vp, markers);\r\n}\r\n\r\nclass MarkerToolbarProvider implements PopupToolbarProvider {\r\n private readonly _viewport: ScreenViewport;\r\n public readonly marker: SectionMarker;\r\n public readonly toolbarProps: AbstractToolbarProps;\r\n public readonly onToolbarItemExecuted: (id: string) => void;\r\n\r\n public constructor(marker: SectionMarker, decorator: HyperModelingDecorator) {\r\n this.marker = marker;\r\n this._viewport = decorator.viewport;\r\n this.toolbarProps = HyperModeling.markerHandler.getToolbarProps(marker, decorator);\r\n this.onToolbarItemExecuted = (id) => HyperModeling.markerHandler.executeCommand(id, marker, decorator); // eslint-disable-line @typescript-eslint/promise-function-async\r\n }\r\n\r\n public get overToolbarHotspot() {\r\n return this.marker.isHilited;\r\n }\r\n\r\n public get toolbarLocation(): XAndY {\r\n return { x: this.marker.rect.right, y: this.marker.rect.top };\r\n }\r\n\r\n public get htmlElement() {\r\n return this._viewport.canvas;\r\n }\r\n}\r\n\r\n/** A [Decorator]($frontend) that displays a [[SectionMarker]] for each [SectionDrawingLocation]($backend) in the view.\r\n * Clicking on a marker toggles the section and the display of associated 2d graphics.\r\n * Hovering over a marker opens a mini toolbar with additional interactions.\r\n * @see [[SectionMarkerHandler]] to customize the marker interactions.\r\n * @see [[HyperModeling.startOrStop]] to enable or disable the decorator for a viewport.\r\n * @public\r\n */\r\nexport class HyperModelingDecorator implements Decorator {\r\n /** The set of [[SectionMarker]]s controlled by this decorator. */\r\n public readonly markers: SectionMarkerSet;\r\n private _config: SectionMarkerConfig;\r\n private readonly _removeEventListeners = new Array<() => void>();\r\n private readonly _iModel: IModelConnection;\r\n private _needSync = false;\r\n private _toolbarProvider?: MarkerToolbarProvider;\r\n private _tiledGraphicsProvider?: TiledGraphicsProvider;\r\n private _activeMarker?: SectionMarker;\r\n private _appliedSpatialView?: SpatialViewState;\r\n /** @internal */\r\n public syncImmediately = false;\r\n\r\n /** Create a new decorator and register it with the [ViewManager]($frontend). Typically invoked indirectly via [[HyperModeling.startOrStop]]. */\r\n public static async create(vp: ScreenViewport, config: SectionMarkerConfig): Promise<HyperModelingDecorator | undefined> {\r\n const markers = await createMarkers(vp);\r\n return undefined !== markers ? new HyperModelingDecorator(markers, config) : undefined;\r\n }\r\n\r\n /** Obtain the decorator associated with the specified viewport, if any. */\r\n public static getForViewport(vp: ScreenViewport): HyperModelingDecorator | undefined {\r\n for (const decorator of IModelApp.viewManager.decorators)\r\n if (decorator instanceof HyperModelingDecorator && decorator.viewport === vp)\r\n return decorator;\r\n\r\n return undefined;\r\n }\r\n\r\n /** The viewport into which this decorator draws its [[SectionMarker]]s. */\r\n public get viewport(): ScreenViewport {\r\n return this.markers.viewport;\r\n }\r\n\r\n /** The currently active marker. A marker typically becomes active when the user clicks on it.\r\n * @see [[setActiveMarker]] to change the active marker without user interaction.\r\n */\r\n public get activeMarker(): SectionMarker | undefined {\r\n return this._activeMarker;\r\n }\r\n\r\n /** @internal */\r\n public get config(): SectionMarkerConfig {\r\n return this._config;\r\n }\r\n\r\n /** Replaces the current marker display configuration, overwriting all previous settings. Passing `undefined` resets all settings to defaults.\r\n * @see [[updateConfiguration]] to override specific aspects of the configuration\r\n * @see [[HyperModeling.replaceConfiguration]] to replace the global configuration.\r\n */\r\n public replaceConfiguration(config?: SectionMarkerConfig): void {\r\n this._config = config ? { ...config } : {};\r\n this.requestSync();\r\n }\r\n\r\n /** Overrides specific aspects of the current marker display configuration.\r\n * Any field that is not `undefined` will be replaced in the current configuration; the rest will retain their current values.\r\n * @see [[replaceConfiguration]] to override all settings.\r\n * @see [[HyperModeling.updateConfiguration]] to update the global configuration.\r\n */\r\n public updateConfiguration(config: SectionMarkerConfig): void {\r\n this._config = {\r\n ignoreModelSelector: config.ignoreModelSelector ?? this._config.ignoreModelSelector,\r\n ignoreCategorySelector: config.ignoreCategorySelector ?? this._config.ignoreCategorySelector,\r\n hiddenSectionTypes: config.hiddenSectionTypes ?? this._config.hiddenSectionTypes,\r\n };\r\n\r\n this.requestSync();\r\n }\r\n\r\n /** Sets the currently active marker. This function is invoked when the user clicks on a marker, but may also be called manually to produce the same result.\r\n * Changing the active marker first deactivates the currently active marker, if any; then activates the specified marker, if supplied.\r\n * Returns false if marker activation fails.\r\n * @see [[activeMarker]] to obtain the currently active section marker.\r\n * @see [[SectionMarkerHandler.activateMarker]] to control what happens when a marker is activated.\r\n * @see [[SectionMarkerHandler.deactivateMarker]] to control what happens when a marker is deactivated.\r\n */\r\n public async setActiveMarker(marker: SectionMarker | undefined): Promise<boolean> {\r\n if (marker === this.activeMarker)\r\n return true;\r\n\r\n if (this.activeMarker) {\r\n this.activeMarker.setActive(false);\r\n await HyperModeling.markerHandler.deactivateMarker(this.activeMarker, this);\r\n this._activeMarker = undefined;\r\n }\r\n\r\n if (marker) {\r\n if (!await HyperModeling.markerHandler.activateMarker(marker, this)) {\r\n this.requestSync();\r\n return false;\r\n }\r\n\r\n marker.setActive(true);\r\n this._activeMarker = marker;\r\n }\r\n\r\n this.requestSync();\r\n return true;\r\n }\r\n\r\n /** @internal */\r\n public readonly useCachedDecorations = true;\r\n\r\n /** @internal */\r\n public decorate(context: DecorateContext): void {\r\n if (this.viewport.view.is3d())\r\n this.markers.addDecoration(context);\r\n }\r\n\r\n private constructor(markers: SectionMarkerSet, config: SectionMarkerConfig) {\r\n this.markers = markers;\r\n this._config = { ...config };\r\n this._iModel = this.viewport.iModel;\r\n\r\n this.viewport.onChangeView.addOnce(() => {\r\n this.requestSync();\r\n });\r\n\r\n this._removeEventListeners.push(this.viewport.onViewportChanged.addListener((_, changeFlags) => this.onViewportChanged(changeFlags)));\r\n this._removeEventListeners.push(this.viewport.onDisposed.addListener(() => this.dispose()));\r\n\r\n for (const marker of markers.markers) {\r\n marker.onMouseEnterEvent.addListener((mkr) => this.showToolbarAfterTimeout(mkr));\r\n marker.onMouseButtonEvent.addListener((mkr) => this.toggleMarker(mkr)); // eslint-disable-line @typescript-eslint/promise-function-async\r\n }\r\n\r\n this.updateMarkerVisibility();\r\n IModelApp.viewManager.addDecorator(this);\r\n }\r\n\r\n private onViewportChanged(changeFlags: ChangeFlags): void {\r\n if (this.viewport.iModel !== this._iModel) {\r\n this.dispose();\r\n return;\r\n }\r\n\r\n if (changeFlags.viewedCategories || changeFlags.viewedModels || changeFlags.viewedCategoriesPerModel)\r\n this.requestSync();\r\n\r\n if (changeFlags.viewState) {\r\n // If we're looking at a different view now, and we did not initiate that, turn off the active marker.\r\n if (this.viewport.view !== this._appliedSpatialView)\r\n this.setActiveMarker(undefined); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n else\r\n this._appliedSpatialView = undefined;\r\n }\r\n }\r\n\r\n private async toggleMarker(marker: SectionMarker): Promise<void> {\r\n await this.setActiveMarker(marker === this.activeMarker ? undefined : marker);\r\n }\r\n\r\n private dropTiledGraphicsProvider(): void {\r\n if (undefined === this._tiledGraphicsProvider)\r\n return;\r\n\r\n this.viewport.dropTiledGraphicsProvider(this._tiledGraphicsProvider);\r\n this._tiledGraphicsProvider = undefined;\r\n }\r\n\r\n /** @internal */\r\n public dispose(): void {\r\n if (!IModelApp.viewManager.dropDecorator(this))\r\n return;\r\n\r\n for (const remove of this._removeEventListeners)\r\n remove();\r\n\r\n this.dropTiledGraphicsProvider();\r\n }\r\n\r\n private showToolbarAfterTimeout(marker: SectionMarker): void {\r\n if (this._toolbarProvider?.marker !== marker)\r\n this._toolbarProvider = new MarkerToolbarProvider(marker, this);\r\n\r\n PopupToolbarManager.showToolbarAfterTimeout(this._toolbarProvider);\r\n }\r\n\r\n /** Toggles whether the clip volume associated with the specified marker is applied to the view. */\r\n public toggleClipVolume(marker: SectionMarker, enable: boolean): void {\r\n ViewClipTool.enableClipVolume(this.viewport);\r\n ViewClipTool.setViewClip(this.viewport, enable ? marker.state.clip : undefined);\r\n }\r\n\r\n /** Toggles the specified section marker.\r\n * Enabling the section applies the frustum and clip volume of the marker's spatial view to the viewport, and displays the 2d section graphics and sheet annotations.\r\n * Disabling the section disables the clip volume and 2d graphics.\r\n * @see [[toggleClipVolume]] to toggle only the clip volume.\r\n * @see [[toggleAttachment]] to toggle only the attachment graphics.\r\n */\r\n public async toggleSection(marker: SectionMarker, enable: boolean): Promise<boolean> {\r\n if (enable) {\r\n if (this.viewport.view.is3d()) {\r\n // Preserve the view settings; apply only the frustum and clip volume\r\n const spatialView = await marker.state.tryLoadSpatialView();\r\n if (!spatialView)\r\n return false;\r\n\r\n const aligned = await this.alignToSpatialView(marker);\r\n if (!aligned)\r\n return false;\r\n\r\n this.toggleClipVolume(marker, true);\r\n } else if (!await this.applySpatialView(marker)) {\r\n return false;\r\n }\r\n } else {\r\n this.toggleClipVolume(marker, false);\r\n }\r\n\r\n this.requestSync();\r\n return this.toggleAttachment(marker, enable);\r\n }\r\n\r\n /** Toggles display of 2d section graphics and sheet annotations for the specified marker.\r\n * @see [[toggleSection]] to apply the spatial view and clip volume in addition to the attachment graphics.\r\n */\r\n public async toggleAttachment(marker: SectionMarker, enable: boolean): Promise<boolean> {\r\n this.dropTiledGraphicsProvider();\r\n if (enable) {\r\n this._tiledGraphicsProvider = await createSectionGraphicsProvider(marker.state);\r\n this.viewport.addTiledGraphicsProvider(this._tiledGraphicsProvider);\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /** Aligns the viewport to face the specified marker's section plane. */\r\n public alignView(marker: SectionMarker): void {\r\n const placement = marker.state.placement.transform;\r\n const origin = placement.origin;\r\n const matrix = placement.matrix;\r\n\r\n const vp = this.viewport;\r\n const targetMatrix = matrix.multiplyMatrixMatrix(vp.rotation);\r\n const rotateTransform = Transform.createFixedPointAndMatrix(origin, targetMatrix);\r\n\r\n const startFrustum = vp.getFrustum();\r\n const newFrustum = startFrustum.clone();\r\n newFrustum.multiply(rotateTransform);\r\n\r\n if (startFrustum.equals(newFrustum))\r\n return;\r\n\r\n vp.view.setupFromFrustum(newFrustum);\r\n vp.synchWithView();\r\n vp.animateFrustumChange();\r\n }\r\n\r\n /** Opens the marker's drawing view in the decorator's viewport. Returns false if the drawing view could not be loaded. */\r\n public async openSection(marker: SectionMarker): Promise<boolean> {\r\n const viewState = await marker.state.tryLoadDrawingView();\r\n if (viewState)\r\n this.viewport.changeView(viewState);\r\n\r\n return undefined !== viewState;\r\n }\r\n\r\n /** Opens marker's sheet view in the decorator's viewport and zooms in on the associated [ViewAttachment]($backend). Returns false if no view\r\n * attachment exists or the sheet view could not be loaded.\r\n */\r\n public async openSheet(marker: SectionMarker): Promise<boolean> {\r\n if (undefined === marker.state.viewAttachment)\r\n return false;\r\n\r\n const viewState = await marker.state.tryLoadSheetView();\r\n if (!viewState)\r\n return false;\r\n\r\n this.viewport.changeView(viewState);\r\n await this.viewport.zoomToElements(marker.state.viewAttachment.id);\r\n return true;\r\n }\r\n\r\n /** Aligns the view to match the frustum of the spatial view associated with the specified marker.\r\n * @param marker The marker whose spatial view's frustum should be applied.\r\n * @returns false if the frustum could not be applied, e.g. because the spatial view could not be loaded or the viewport is viewing a 2d model.\r\n * @see [[alignView]] to align to the *section plane*, which may differ.\r\n * @see [[toggleSection]] to also apply the clip volume.\r\n */\r\n public async alignToSpatialView(marker: SectionMarker): Promise<boolean> {\r\n if (!this.viewport.view.is3d())\r\n return false;\r\n\r\n const spatialView = await marker.state.tryLoadSpatialView();\r\n if (!spatialView)\r\n return false;\r\n\r\n this.viewport.view.setOrigin(spatialView.getOrigin());\r\n this.viewport.view.setExtents(spatialView.getExtents());\r\n this.viewport.view.setRotation(spatialView.getRotation());\r\n this.viewport.synchWithView({ animateFrustumChange: true });\r\n\r\n return true;\r\n }\r\n\r\n /** Applies the marker's spatial view - including its clip volume - to the decorator's viewport.\r\n * Returns false if the spatial view could not be loaded.\r\n * @see [[toggleSection]].\r\n * @see [[toggleClipVolume]].\r\n */\r\n public async applySpatialView(marker: SectionMarker): Promise<boolean> {\r\n const viewState = await marker.state.tryLoadSpatialView();\r\n if (viewState) {\r\n this._appliedSpatialView = viewState;\r\n this.viewport.changeView(viewState);\r\n }\r\n\r\n return undefined !== viewState;\r\n }\r\n\r\n /** Request that the visibility of the section markers be recomputed. It is only necessary to call this if you have overridden [[SectionMarkerHandler.isMarkerVisible]]; if so, you should invoke\r\n * this method when the criteria governing your `isMarkerVisible` method have changed.\r\n */\r\n public requestSync(): void {\r\n if (this.syncImmediately) {\r\n this.sync();\r\n } else if (!this._needSync) {\r\n this._needSync = true;\r\n requestAnimationFrame(() => this.sync());\r\n }\r\n }\r\n\r\n private sync(): void {\r\n this._needSync = false;\r\n if (HyperModeling.isInitialized && this.viewport.view.is3d() && this.updateMarkerVisibility()) {\r\n this.markers.markDirty();\r\n this.viewport.invalidateCachedDecorations(this);\r\n }\r\n }\r\n\r\n private isMarkerVisible(marker: SectionMarker): boolean {\r\n if (undefined !== this.activeMarker)\r\n return marker === this.activeMarker;\r\n\r\n return HyperModeling.markerHandler.isMarkerVisible(marker, this, this._config);\r\n }\r\n\r\n private updateMarkerVisibility(): boolean {\r\n let changed = false;\r\n for (const marker of this.markers.markers) {\r\n const wasVisible = marker.visible;\r\n marker.visible = this.isMarkerVisible(marker);\r\n changed = changed || (marker.visible !== wasVisible);\r\n }\r\n\r\n return changed;\r\n }\r\n}\r\n"]}
|
package/lib/cjs/PopupToolbar.js
CHANGED
|
@@ -16,7 +16,7 @@ class PopupToolbarManager {
|
|
|
16
16
|
if (!prov || !prov.overToolbarHotspot)
|
|
17
17
|
return false;
|
|
18
18
|
const admin = core_frontend_1.IModelApp.uiAdmin;
|
|
19
|
-
if (!admin.showToolbar(prov.toolbarProps, prov.toolbarLocation,
|
|
19
|
+
if (!admin.showToolbar(prov.toolbarProps, prov.toolbarLocation, { x: 0, y: 0 }, this._itemExecuted, this._cancel, undefined, prov.htmlElement))
|
|
20
20
|
return false;
|
|
21
21
|
this._current = this._provider;
|
|
22
22
|
this._provider = undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupToolbar.js","sourceRoot":"","sources":["../../src/PopupToolbar.ts"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AI,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC1B,OAAO,yBAAS,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;IACzC,CAAC;IAEO,MAAM,CAAC,iBAAiB;QAC9B,IAAI,CAAC,IAAI,CAAC,QAAQ;YAChB,OAAO;QAET,MAAM,KAAK,GAAG,IAAI,CAAC;QACnB,IAAI,IAAI,CAAC,QAAQ,CAAC,kBAAkB,IAAI,CAAC,yBAAS,CAAC,SAAS,CAAC,UAAU;YACrE,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,kDAAkD;;YAErG,IAAI,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;IAEM,MAAM,CAAC,uBAAuB,CAAC,QAA8B;QAClE,IAAI,IAAI,CAAC,QAAQ,KAAK,QAAQ;YAC5B,OAAO;QAET,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC;IACrC,CAAC;;AApCc,iCAAa,GAAG,CAAC,IAAS,EAAE,EAAE;IAC3C,MAAM,GAAG,GAAG,mBAAmB,CAAC;IAChC,IAAI,GAAG,CAAC,QAAQ;QACd,GAAG,CAAC,QAAQ,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAE9C,GAAG,CAAC,KAAK,EAAE,CAAC;AACd,CAAC,CAAC;AAEa,2BAAO,GAAG,GAAG,EAAE;IAC5B,MAAM,GAAG,GAAG,mBAAmB,CAAC;IAChC,IAAI,CAAC,GAAG,CAAC,QAAQ,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,kBAAkB;QACnD,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,wCAAwC;AACzD,CAAC,CAAC;AA/BS,kDAAmB","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/** @packageDocumentation\r\n * @module HyperModeling\r\n */\r\n\r\nimport { XAndY } from \"@itwin/core-geometry\";\r\nimport type { AbstractToolbarProps } from \"@itwin/appui-abstract\";\r\nimport { IModelApp } from \"@itwin/core-frontend\";\r\n\r\n/** @internal */\r\nexport interface PopupToolbarProvider {\r\n toolbarProps: AbstractToolbarProps;\r\n overToolbarHotspot: boolean;\r\n toolbarLocation: XAndY;\r\n htmlElement: HTMLElement | undefined;\r\n onToolbarItemExecuted(id: string): void;\r\n}\r\n\r\n/** @internal */\r\nexport class PopupToolbarManager {\r\n private static _provider?: PopupToolbarProvider;\r\n private static _current?: PopupToolbarProvider;\r\n\r\n private static show(): boolean {\r\n const prov = this._provider;\r\n if (!prov || !prov.overToolbarHotspot)\r\n return false;\r\n\r\n const admin = IModelApp.uiAdmin;\r\n if (!admin.showToolbar(prov.toolbarProps, prov.toolbarLocation, { x: 0, y: 0 }, this._itemExecuted, this._cancel, undefined, prov.htmlElement))\r\n return false;\r\n\r\n this._current = this._provider;\r\n this._provider = undefined;\r\n this.closeAfterTimeout();\r\n return true;\r\n }\r\n\r\n private static _itemExecuted = (item: any) => {\r\n const mgr = PopupToolbarManager;\r\n if (mgr._current)\r\n mgr._current.onToolbarItemExecuted(item.id);\r\n\r\n mgr.close();\r\n };\r\n\r\n private static _cancel = () => {\r\n const mgr = PopupToolbarManager;\r\n if (!mgr._current || !mgr._current.overToolbarHotspot)\r\n mgr.close(); // Don't hide when click is over hotspot\r\n };\r\n\r\n private static close(): boolean {\r\n this._current = undefined;\r\n return IModelApp.uiAdmin.hideToolbar();\r\n }\r\n\r\n private static closeAfterTimeout(): void {\r\n if (!this._current)\r\n return;\r\n\r\n const delay = 1000;\r\n if (this._current.overToolbarHotspot || !IModelApp.toolAdmin.cursorView)\r\n setTimeout(() => this.closeAfterTimeout(), delay); // Cursor not in view or over hotspot, check again\r\n else\r\n this.close();\r\n }\r\n\r\n public static showToolbarAfterTimeout(provider: PopupToolbarProvider): void {\r\n if (this._current === provider)\r\n return;\r\n\r\n this._provider = provider;\r\n setTimeout(() => this.show(), 500);\r\n }\r\n}\r\n"]}
|
|
@@ -32,7 +32,7 @@ class MarkerToolbarProvider {
|
|
|
32
32
|
return this.marker.isHilited;
|
|
33
33
|
}
|
|
34
34
|
get toolbarLocation() {
|
|
35
|
-
return
|
|
35
|
+
return { x: this.marker.rect.right, y: this.marker.rect.top };
|
|
36
36
|
}
|
|
37
37
|
get htmlElement() {
|
|
38
38
|
return this._viewport.canvas;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HyperModelingDecorator.js","sourceRoot":"","sources":["../../src/HyperModelingDecorator.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAS,MAAM,sBAAsB,CAAC;AAExD,OAAO,EACoC,SAAS,EAA6E,YAAY,GAC5I,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAwB,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,KAAK,UAAU,aAAa,CAAC,EAAkB;IAC7C,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE;QAC1B,OAAO,SAAS,CAAC;IAEnB,MAAM,MAAM,GAAG,MAAM,2BAA2B,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;IACrE,IAAI,CAAC,KAAK,MAAM,CAAC,MAAM;QACrB,OAAO,SAAS,CAAC;IAEnB,MAAM,OAAO,GAAG,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C,SAAS,EAAE;YAC1B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,qBAAqB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;SAC1C;IACH,CAAC;IAEO,IAAI;QACV,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,IAAI,aAAa,CAAC,aAAa,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC,sBAAsB,EAAE,EAAE;YAC7F,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;YACzB,IAAI,CAAC,QAAQ,CAAC,2BAA2B,CAAC,IAAI,CAAC,CAAC;SACjD;IACH,CAAC;IAEO,eAAe,CAAC,MAAqB;QAC3C,IAAI,SAAS,KAAK,IAAI,CAAC,YAAY;YACjC,OAAO,MAAM,KAAK,IAAI,CAAC,YAAY,CAAC;QAEtC,OAAO,aAAa,CAAC,aAAa,CAAC,eAAe,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACjF,CAAC;IAEO,sBAAsB;QAC5B,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACzC,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC;YAClC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YAC9C,OAAO,GAAG,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC;SACtD;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF","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/** @packageDocumentation\r\n * @module HyperModeling\r\n */\r\n\r\nimport { Transform, XAndY } from \"@itwin/core-geometry\";\r\nimport type { AbstractToolbarProps } from \"@itwin/appui-abstract\";\r\nimport {\r\n ChangeFlags, DecorateContext, Decorator, IModelApp, IModelConnection, ScreenViewport, SpatialViewState, TiledGraphicsProvider, ViewClipTool,\r\n} from \"@itwin/core-frontend\";\r\nimport { SectionMarker, SectionMarkerSet } from \"./SectionMarkers\";\r\nimport { SectionDrawingLocationState } from \"./SectionDrawingLocationState\";\r\nimport { createSectionGraphicsProvider } from \"./SectionGraphicsProvider\";\r\nimport { PopupToolbarManager, PopupToolbarProvider } from \"./PopupToolbar\";\r\nimport { HyperModeling } from \"./HyperModeling\";\r\nimport { SectionMarkerConfig } from \"./HyperModelingConfig\";\r\n\r\nasync function createMarkers(vp: ScreenViewport): Promise<SectionMarkerSet | undefined> {\r\n if (!vp.view.isSpatialView())\r\n return undefined;\r\n\r\n const states = await SectionDrawingLocationState.queryAll(vp.iModel);\r\n if (0 === states.length)\r\n return undefined;\r\n\r\n const markers = states.map((state) => new SectionMarker(state));\r\n return new SectionMarkerSet(vp, markers);\r\n}\r\n\r\nclass MarkerToolbarProvider implements PopupToolbarProvider {\r\n private readonly _viewport: ScreenViewport;\r\n public readonly marker: SectionMarker;\r\n public readonly toolbarProps: AbstractToolbarProps;\r\n public readonly onToolbarItemExecuted: (id: string) => void;\r\n\r\n public constructor(marker: SectionMarker, decorator: HyperModelingDecorator) {\r\n this.marker = marker;\r\n this._viewport = decorator.viewport;\r\n this.toolbarProps = HyperModeling.markerHandler.getToolbarProps(marker, decorator);\r\n this.onToolbarItemExecuted = (id) => HyperModeling.markerHandler.executeCommand(id, marker, decorator); // eslint-disable-line @typescript-eslint/promise-function-async\r\n }\r\n\r\n public get overToolbarHotspot() {\r\n return this.marker.isHilited;\r\n }\r\n\r\n public get toolbarLocation(): XAndY {\r\n return IModelApp.uiAdmin.createXAndY(this.marker.rect.right, this.marker.rect.top);\r\n }\r\n\r\n public get htmlElement() {\r\n return this._viewport.canvas;\r\n }\r\n}\r\n\r\n/** A [Decorator]($frontend) that displays a [[SectionMarker]] for each [SectionDrawingLocation]($backend) in the view.\r\n * Clicking on a marker toggles the section and the display of associated 2d graphics.\r\n * Hovering over a marker opens a mini toolbar with additional interactions.\r\n * @see [[SectionMarkerHandler]] to customize the marker interactions.\r\n * @see [[HyperModeling.startOrStop]] to enable or disable the decorator for a viewport.\r\n * @public\r\n */\r\nexport class HyperModelingDecorator implements Decorator {\r\n /** The set of [[SectionMarker]]s controlled by this decorator. */\r\n public readonly markers: SectionMarkerSet;\r\n private _config: SectionMarkerConfig;\r\n private readonly _removeEventListeners = new Array<() => void>();\r\n private readonly _iModel: IModelConnection;\r\n private _needSync = false;\r\n private _toolbarProvider?: MarkerToolbarProvider;\r\n private _tiledGraphicsProvider?: TiledGraphicsProvider;\r\n private _activeMarker?: SectionMarker;\r\n private _appliedSpatialView?: SpatialViewState;\r\n /** @internal */\r\n public syncImmediately = false;\r\n\r\n /** Create a new decorator and register it with the [ViewManager]($frontend). Typically invoked indirectly via [[HyperModeling.startOrStop]]. */\r\n public static async create(vp: ScreenViewport, config: SectionMarkerConfig): Promise<HyperModelingDecorator | undefined> {\r\n const markers = await createMarkers(vp);\r\n return undefined !== markers ? new HyperModelingDecorator(markers, config) : undefined;\r\n }\r\n\r\n /** Obtain the decorator associated with the specified viewport, if any. */\r\n public static getForViewport(vp: ScreenViewport): HyperModelingDecorator | undefined {\r\n for (const decorator of IModelApp.viewManager.decorators)\r\n if (decorator instanceof HyperModelingDecorator && decorator.viewport === vp)\r\n return decorator;\r\n\r\n return undefined;\r\n }\r\n\r\n /** The viewport into which this decorator draws its [[SectionMarker]]s. */\r\n public get viewport(): ScreenViewport {\r\n return this.markers.viewport;\r\n }\r\n\r\n /** The currently active marker. A marker typically becomes active when the user clicks on it.\r\n * @see [[setActiveMarker]] to change the active marker without user interaction.\r\n */\r\n public get activeMarker(): SectionMarker | undefined {\r\n return this._activeMarker;\r\n }\r\n\r\n /** @internal */\r\n public get config(): SectionMarkerConfig {\r\n return this._config;\r\n }\r\n\r\n /** Replaces the current marker display configuration, overwriting all previous settings. Passing `undefined` resets all settings to defaults.\r\n * @see [[updateConfiguration]] to override specific aspects of the configuration\r\n * @see [[HyperModeling.replaceConfiguration]] to replace the global configuration.\r\n */\r\n public replaceConfiguration(config?: SectionMarkerConfig): void {\r\n this._config = config ? { ...config } : {};\r\n this.requestSync();\r\n }\r\n\r\n /** Overrides specific aspects of the current marker display configuration.\r\n * Any field that is not `undefined` will be replaced in the current configuration; the rest will retain their current values.\r\n * @see [[replaceConfiguration]] to override all settings.\r\n * @see [[HyperModeling.updateConfiguration]] to update the global configuration.\r\n */\r\n public updateConfiguration(config: SectionMarkerConfig): void {\r\n this._config = {\r\n ignoreModelSelector: config.ignoreModelSelector ?? this._config.ignoreModelSelector,\r\n ignoreCategorySelector: config.ignoreCategorySelector ?? this._config.ignoreCategorySelector,\r\n hiddenSectionTypes: config.hiddenSectionTypes ?? this._config.hiddenSectionTypes,\r\n };\r\n\r\n this.requestSync();\r\n }\r\n\r\n /** Sets the currently active marker. This function is invoked when the user clicks on a marker, but may also be called manually to produce the same result.\r\n * Changing the active marker first deactivates the currently active marker, if any; then activates the specified marker, if supplied.\r\n * Returns false if marker activation fails.\r\n * @see [[activeMarker]] to obtain the currently active section marker.\r\n * @see [[SectionMarkerHandler.activateMarker]] to control what happens when a marker is activated.\r\n * @see [[SectionMarkerHandler.deactivateMarker]] to control what happens when a marker is deactivated.\r\n */\r\n public async setActiveMarker(marker: SectionMarker | undefined): Promise<boolean> {\r\n if (marker === this.activeMarker)\r\n return true;\r\n\r\n if (this.activeMarker) {\r\n this.activeMarker.setActive(false);\r\n await HyperModeling.markerHandler.deactivateMarker(this.activeMarker, this);\r\n this._activeMarker = undefined;\r\n }\r\n\r\n if (marker) {\r\n if (!await HyperModeling.markerHandler.activateMarker(marker, this)) {\r\n this.requestSync();\r\n return false;\r\n }\r\n\r\n marker.setActive(true);\r\n this._activeMarker = marker;\r\n }\r\n\r\n this.requestSync();\r\n return true;\r\n }\r\n\r\n /** @internal */\r\n public readonly useCachedDecorations = true;\r\n\r\n /** @internal */\r\n public decorate(context: DecorateContext): void {\r\n if (this.viewport.view.is3d())\r\n this.markers.addDecoration(context);\r\n }\r\n\r\n private constructor(markers: SectionMarkerSet, config: SectionMarkerConfig) {\r\n this.markers = markers;\r\n this._config = { ...config };\r\n this._iModel = this.viewport.iModel;\r\n\r\n this.viewport.onChangeView.addOnce(() => {\r\n this.requestSync();\r\n });\r\n\r\n this._removeEventListeners.push(this.viewport.onViewportChanged.addListener((_, changeFlags) => this.onViewportChanged(changeFlags)));\r\n this._removeEventListeners.push(this.viewport.onDisposed.addListener(() => this.dispose()));\r\n\r\n for (const marker of markers.markers) {\r\n marker.onMouseEnterEvent.addListener((mkr) => this.showToolbarAfterTimeout(mkr));\r\n marker.onMouseButtonEvent.addListener((mkr) => this.toggleMarker(mkr)); // eslint-disable-line @typescript-eslint/promise-function-async\r\n }\r\n\r\n this.updateMarkerVisibility();\r\n IModelApp.viewManager.addDecorator(this);\r\n }\r\n\r\n private onViewportChanged(changeFlags: ChangeFlags): void {\r\n if (this.viewport.iModel !== this._iModel) {\r\n this.dispose();\r\n return;\r\n }\r\n\r\n if (changeFlags.viewedCategories || changeFlags.viewedModels || changeFlags.viewedCategoriesPerModel)\r\n this.requestSync();\r\n\r\n if (changeFlags.viewState) {\r\n // If we're looking at a different view now, and we did not initiate that, turn off the active marker.\r\n if (this.viewport.view !== this._appliedSpatialView)\r\n this.setActiveMarker(undefined); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n else\r\n this._appliedSpatialView = undefined;\r\n }\r\n }\r\n\r\n private async toggleMarker(marker: SectionMarker): Promise<void> {\r\n await this.setActiveMarker(marker === this.activeMarker ? undefined : marker);\r\n }\r\n\r\n private dropTiledGraphicsProvider(): void {\r\n if (undefined === this._tiledGraphicsProvider)\r\n return;\r\n\r\n this.viewport.dropTiledGraphicsProvider(this._tiledGraphicsProvider);\r\n this._tiledGraphicsProvider = undefined;\r\n }\r\n\r\n /** @internal */\r\n public dispose(): void {\r\n if (!IModelApp.viewManager.dropDecorator(this))\r\n return;\r\n\r\n for (const remove of this._removeEventListeners)\r\n remove();\r\n\r\n this.dropTiledGraphicsProvider();\r\n }\r\n\r\n private showToolbarAfterTimeout(marker: SectionMarker): void {\r\n if (this._toolbarProvider?.marker !== marker)\r\n this._toolbarProvider = new MarkerToolbarProvider(marker, this);\r\n\r\n PopupToolbarManager.showToolbarAfterTimeout(this._toolbarProvider);\r\n }\r\n\r\n /** Toggles whether the clip volume associated with the specified marker is applied to the view. */\r\n public toggleClipVolume(marker: SectionMarker, enable: boolean): void {\r\n ViewClipTool.enableClipVolume(this.viewport);\r\n ViewClipTool.setViewClip(this.viewport, enable ? marker.state.clip : undefined);\r\n }\r\n\r\n /** Toggles the specified section marker.\r\n * Enabling the section applies the frustum and clip volume of the marker's spatial view to the viewport, and displays the 2d section graphics and sheet annotations.\r\n * Disabling the section disables the clip volume and 2d graphics.\r\n * @see [[toggleClipVolume]] to toggle only the clip volume.\r\n * @see [[toggleAttachment]] to toggle only the attachment graphics.\r\n */\r\n public async toggleSection(marker: SectionMarker, enable: boolean): Promise<boolean> {\r\n if (enable) {\r\n if (this.viewport.view.is3d()) {\r\n // Preserve the view settings; apply only the frustum and clip volume\r\n const spatialView = await marker.state.tryLoadSpatialView();\r\n if (!spatialView)\r\n return false;\r\n\r\n const aligned = await this.alignToSpatialView(marker);\r\n if (!aligned)\r\n return false;\r\n\r\n this.toggleClipVolume(marker, true);\r\n } else if (!await this.applySpatialView(marker)) {\r\n return false;\r\n }\r\n } else {\r\n this.toggleClipVolume(marker, false);\r\n }\r\n\r\n this.requestSync();\r\n return this.toggleAttachment(marker, enable);\r\n }\r\n\r\n /** Toggles display of 2d section graphics and sheet annotations for the specified marker.\r\n * @see [[toggleSection]] to apply the spatial view and clip volume in addition to the attachment graphics.\r\n */\r\n public async toggleAttachment(marker: SectionMarker, enable: boolean): Promise<boolean> {\r\n this.dropTiledGraphicsProvider();\r\n if (enable) {\r\n this._tiledGraphicsProvider = await createSectionGraphicsProvider(marker.state);\r\n this.viewport.addTiledGraphicsProvider(this._tiledGraphicsProvider);\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /** Aligns the viewport to face the specified marker's section plane. */\r\n public alignView(marker: SectionMarker): void {\r\n const placement = marker.state.placement.transform;\r\n const origin = placement.origin;\r\n const matrix = placement.matrix;\r\n\r\n const vp = this.viewport;\r\n const targetMatrix = matrix.multiplyMatrixMatrix(vp.rotation);\r\n const rotateTransform = Transform.createFixedPointAndMatrix(origin, targetMatrix);\r\n\r\n const startFrustum = vp.getFrustum();\r\n const newFrustum = startFrustum.clone();\r\n newFrustum.multiply(rotateTransform);\r\n\r\n if (startFrustum.equals(newFrustum))\r\n return;\r\n\r\n vp.view.setupFromFrustum(newFrustum);\r\n vp.synchWithView();\r\n vp.animateFrustumChange();\r\n }\r\n\r\n /** Opens the marker's drawing view in the decorator's viewport. Returns false if the drawing view could not be loaded. */\r\n public async openSection(marker: SectionMarker): Promise<boolean> {\r\n const viewState = await marker.state.tryLoadDrawingView();\r\n if (viewState)\r\n this.viewport.changeView(viewState);\r\n\r\n return undefined !== viewState;\r\n }\r\n\r\n /** Opens marker's sheet view in the decorator's viewport and zooms in on the associated [ViewAttachment]($backend). Returns false if no view\r\n * attachment exists or the sheet view could not be loaded.\r\n */\r\n public async openSheet(marker: SectionMarker): Promise<boolean> {\r\n if (undefined === marker.state.viewAttachment)\r\n return false;\r\n\r\n const viewState = await marker.state.tryLoadSheetView();\r\n if (!viewState)\r\n return false;\r\n\r\n this.viewport.changeView(viewState);\r\n await this.viewport.zoomToElements(marker.state.viewAttachment.id);\r\n return true;\r\n }\r\n\r\n /** Aligns the view to match the frustum of the spatial view associated with the specified marker.\r\n * @param marker The marker whose spatial view's frustum should be applied.\r\n * @returns false if the frustum could not be applied, e.g. because the spatial view could not be loaded or the viewport is viewing a 2d model.\r\n * @see [[alignView]] to align to the *section plane*, which may differ.\r\n * @see [[toggleSection]] to also apply the clip volume.\r\n */\r\n public async alignToSpatialView(marker: SectionMarker): Promise<boolean> {\r\n if (!this.viewport.view.is3d())\r\n return false;\r\n\r\n const spatialView = await marker.state.tryLoadSpatialView();\r\n if (!spatialView)\r\n return false;\r\n\r\n this.viewport.view.setOrigin(spatialView.getOrigin());\r\n this.viewport.view.setExtents(spatialView.getExtents());\r\n this.viewport.view.setRotation(spatialView.getRotation());\r\n this.viewport.synchWithView({ animateFrustumChange: true });\r\n\r\n return true;\r\n }\r\n\r\n /** Applies the marker's spatial view - including its clip volume - to the decorator's viewport.\r\n * Returns false if the spatial view could not be loaded.\r\n * @see [[toggleSection]].\r\n * @see [[toggleClipVolume]].\r\n */\r\n public async applySpatialView(marker: SectionMarker): Promise<boolean> {\r\n const viewState = await marker.state.tryLoadSpatialView();\r\n if (viewState) {\r\n this._appliedSpatialView = viewState;\r\n this.viewport.changeView(viewState);\r\n }\r\n\r\n return undefined !== viewState;\r\n }\r\n\r\n /** Request that the visibility of the section markers be recomputed. It is only necessary to call this if you have overridden [[SectionMarkerHandler.isMarkerVisible]]; if so, you should invoke\r\n * this method when the criteria governing your `isMarkerVisible` method have changed.\r\n */\r\n public requestSync(): void {\r\n if (this.syncImmediately) {\r\n this.sync();\r\n } else if (!this._needSync) {\r\n this._needSync = true;\r\n requestAnimationFrame(() => this.sync());\r\n }\r\n }\r\n\r\n private sync(): void {\r\n this._needSync = false;\r\n if (HyperModeling.isInitialized && this.viewport.view.is3d() && this.updateMarkerVisibility()) {\r\n this.markers.markDirty();\r\n this.viewport.invalidateCachedDecorations(this);\r\n }\r\n }\r\n\r\n private isMarkerVisible(marker: SectionMarker): boolean {\r\n if (undefined !== this.activeMarker)\r\n return marker === this.activeMarker;\r\n\r\n return HyperModeling.markerHandler.isMarkerVisible(marker, this, this._config);\r\n }\r\n\r\n private updateMarkerVisibility(): boolean {\r\n let changed = false;\r\n for (const marker of this.markers.markers) {\r\n const wasVisible = marker.visible;\r\n marker.visible = this.isMarkerVisible(marker);\r\n changed = changed || (marker.visible !== wasVisible);\r\n }\r\n\r\n return changed;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"HyperModelingDecorator.js","sourceRoot":"","sources":["../../src/HyperModelingDecorator.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAS,MAAM,sBAAsB,CAAC;AAExD,OAAO,EACoC,SAAS,EAA6E,YAAY,GAC5I,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAwB,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,KAAK,UAAU,aAAa,CAAC,EAAkB;IAC7C,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE;QAC1B,OAAO,SAAS,CAAC;IAEnB,MAAM,MAAM,GAAG,MAAM,2BAA2B,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;IACrE,IAAI,CAAC,KAAK,MAAM,CAAC,MAAM;QACrB,OAAO,SAAS,CAAC;IAEnB,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;IAChE,OAAO,IAAI,gBAAgB,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC;AAED,MAAM,qBAAqB;IAMzB,YAAmB,MAAqB,EAAE,SAAiC;QACzE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,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I,IAAI,CAAC,sBAAsB,EAAE,EAAE;YAC7F,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;YACzB,IAAI,CAAC,QAAQ,CAAC,2BAA2B,CAAC,IAAI,CAAC,CAAC;SACjD;IACH,CAAC;IAEO,eAAe,CAAC,MAAqB;QAC3C,IAAI,SAAS,KAAK,IAAI,CAAC,YAAY;YACjC,OAAO,MAAM,KAAK,IAAI,CAAC,YAAY,CAAC;QAEtC,OAAO,aAAa,CAAC,aAAa,CAAC,eAAe,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACjF,CAAC;IAEO,sBAAsB;QAC5B,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACzC,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC;YAClC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YAC9C,OAAO,GAAG,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC;SACtD;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF","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/** @packageDocumentation\r\n * @module HyperModeling\r\n */\r\n\r\nimport { Transform, XAndY } from \"@itwin/core-geometry\";\r\nimport type { AbstractToolbarProps } from \"@itwin/appui-abstract\";\r\nimport {\r\n ChangeFlags, DecorateContext, Decorator, IModelApp, IModelConnection, ScreenViewport, SpatialViewState, TiledGraphicsProvider, ViewClipTool,\r\n} from \"@itwin/core-frontend\";\r\nimport { SectionMarker, SectionMarkerSet } from \"./SectionMarkers\";\r\nimport { SectionDrawingLocationState } from \"./SectionDrawingLocationState\";\r\nimport { createSectionGraphicsProvider } from \"./SectionGraphicsProvider\";\r\nimport { PopupToolbarManager, PopupToolbarProvider } from \"./PopupToolbar\";\r\nimport { HyperModeling } from \"./HyperModeling\";\r\nimport { SectionMarkerConfig } from \"./HyperModelingConfig\";\r\n\r\nasync function createMarkers(vp: ScreenViewport): Promise<SectionMarkerSet | undefined> {\r\n if (!vp.view.isSpatialView())\r\n return undefined;\r\n\r\n const states = await SectionDrawingLocationState.queryAll(vp.iModel);\r\n if (0 === states.length)\r\n return undefined;\r\n\r\n const markers = states.map((state) => new SectionMarker(state));\r\n return new SectionMarkerSet(vp, markers);\r\n}\r\n\r\nclass MarkerToolbarProvider implements PopupToolbarProvider {\r\n private readonly _viewport: ScreenViewport;\r\n public readonly marker: SectionMarker;\r\n public readonly toolbarProps: AbstractToolbarProps;\r\n public readonly onToolbarItemExecuted: (id: string) => void;\r\n\r\n public constructor(marker: SectionMarker, decorator: HyperModelingDecorator) {\r\n this.marker = marker;\r\n this._viewport = decorator.viewport;\r\n this.toolbarProps = HyperModeling.markerHandler.getToolbarProps(marker, decorator);\r\n this.onToolbarItemExecuted = (id) => HyperModeling.markerHandler.executeCommand(id, marker, decorator); // eslint-disable-line @typescript-eslint/promise-function-async\r\n }\r\n\r\n public get overToolbarHotspot() {\r\n return this.marker.isHilited;\r\n }\r\n\r\n public get toolbarLocation(): XAndY {\r\n return { x: this.marker.rect.right, y: this.marker.rect.top };\r\n }\r\n\r\n public get htmlElement() {\r\n return this._viewport.canvas;\r\n }\r\n}\r\n\r\n/** A [Decorator]($frontend) that displays a [[SectionMarker]] for each [SectionDrawingLocation]($backend) in the view.\r\n * Clicking on a marker toggles the section and the display of associated 2d graphics.\r\n * Hovering over a marker opens a mini toolbar with additional interactions.\r\n * @see [[SectionMarkerHandler]] to customize the marker interactions.\r\n * @see [[HyperModeling.startOrStop]] to enable or disable the decorator for a viewport.\r\n * @public\r\n */\r\nexport class HyperModelingDecorator implements Decorator {\r\n /** The set of [[SectionMarker]]s controlled by this decorator. */\r\n public readonly markers: SectionMarkerSet;\r\n private _config: SectionMarkerConfig;\r\n private readonly _removeEventListeners = new Array<() => void>();\r\n private readonly _iModel: IModelConnection;\r\n private _needSync = false;\r\n private _toolbarProvider?: MarkerToolbarProvider;\r\n private _tiledGraphicsProvider?: TiledGraphicsProvider;\r\n private _activeMarker?: SectionMarker;\r\n private _appliedSpatialView?: SpatialViewState;\r\n /** @internal */\r\n public syncImmediately = false;\r\n\r\n /** Create a new decorator and register it with the [ViewManager]($frontend). Typically invoked indirectly via [[HyperModeling.startOrStop]]. */\r\n public static async create(vp: ScreenViewport, config: SectionMarkerConfig): Promise<HyperModelingDecorator | undefined> {\r\n const markers = await createMarkers(vp);\r\n return undefined !== markers ? new HyperModelingDecorator(markers, config) : undefined;\r\n }\r\n\r\n /** Obtain the decorator associated with the specified viewport, if any. */\r\n public static getForViewport(vp: ScreenViewport): HyperModelingDecorator | undefined {\r\n for (const decorator of IModelApp.viewManager.decorators)\r\n if (decorator instanceof HyperModelingDecorator && decorator.viewport === vp)\r\n return decorator;\r\n\r\n return undefined;\r\n }\r\n\r\n /** The viewport into which this decorator draws its [[SectionMarker]]s. */\r\n public get viewport(): ScreenViewport {\r\n return this.markers.viewport;\r\n }\r\n\r\n /** The currently active marker. A marker typically becomes active when the user clicks on it.\r\n * @see [[setActiveMarker]] to change the active marker without user interaction.\r\n */\r\n public get activeMarker(): SectionMarker | undefined {\r\n return this._activeMarker;\r\n }\r\n\r\n /** @internal */\r\n public get config(): SectionMarkerConfig {\r\n return this._config;\r\n }\r\n\r\n /** Replaces the current marker display configuration, overwriting all previous settings. Passing `undefined` resets all settings to defaults.\r\n * @see [[updateConfiguration]] to override specific aspects of the configuration\r\n * @see [[HyperModeling.replaceConfiguration]] to replace the global configuration.\r\n */\r\n public replaceConfiguration(config?: SectionMarkerConfig): void {\r\n this._config = config ? { ...config } : {};\r\n this.requestSync();\r\n }\r\n\r\n /** Overrides specific aspects of the current marker display configuration.\r\n * Any field that is not `undefined` will be replaced in the current configuration; the rest will retain their current values.\r\n * @see [[replaceConfiguration]] to override all settings.\r\n * @see [[HyperModeling.updateConfiguration]] to update the global configuration.\r\n */\r\n public updateConfiguration(config: SectionMarkerConfig): void {\r\n this._config = {\r\n ignoreModelSelector: config.ignoreModelSelector ?? this._config.ignoreModelSelector,\r\n ignoreCategorySelector: config.ignoreCategorySelector ?? this._config.ignoreCategorySelector,\r\n hiddenSectionTypes: config.hiddenSectionTypes ?? this._config.hiddenSectionTypes,\r\n };\r\n\r\n this.requestSync();\r\n }\r\n\r\n /** Sets the currently active marker. This function is invoked when the user clicks on a marker, but may also be called manually to produce the same result.\r\n * Changing the active marker first deactivates the currently active marker, if any; then activates the specified marker, if supplied.\r\n * Returns false if marker activation fails.\r\n * @see [[activeMarker]] to obtain the currently active section marker.\r\n * @see [[SectionMarkerHandler.activateMarker]] to control what happens when a marker is activated.\r\n * @see [[SectionMarkerHandler.deactivateMarker]] to control what happens when a marker is deactivated.\r\n */\r\n public async setActiveMarker(marker: SectionMarker | undefined): Promise<boolean> {\r\n if (marker === this.activeMarker)\r\n return true;\r\n\r\n if (this.activeMarker) {\r\n this.activeMarker.setActive(false);\r\n await HyperModeling.markerHandler.deactivateMarker(this.activeMarker, this);\r\n this._activeMarker = undefined;\r\n }\r\n\r\n if (marker) {\r\n if (!await HyperModeling.markerHandler.activateMarker(marker, this)) {\r\n this.requestSync();\r\n return false;\r\n }\r\n\r\n marker.setActive(true);\r\n this._activeMarker = marker;\r\n }\r\n\r\n this.requestSync();\r\n return true;\r\n }\r\n\r\n /** @internal */\r\n public readonly useCachedDecorations = true;\r\n\r\n /** @internal */\r\n public decorate(context: DecorateContext): void {\r\n if (this.viewport.view.is3d())\r\n this.markers.addDecoration(context);\r\n }\r\n\r\n private constructor(markers: SectionMarkerSet, config: SectionMarkerConfig) {\r\n this.markers = markers;\r\n this._config = { ...config };\r\n this._iModel = this.viewport.iModel;\r\n\r\n this.viewport.onChangeView.addOnce(() => {\r\n this.requestSync();\r\n });\r\n\r\n this._removeEventListeners.push(this.viewport.onViewportChanged.addListener((_, changeFlags) => this.onViewportChanged(changeFlags)));\r\n this._removeEventListeners.push(this.viewport.onDisposed.addListener(() => this.dispose()));\r\n\r\n for (const marker of markers.markers) {\r\n marker.onMouseEnterEvent.addListener((mkr) => this.showToolbarAfterTimeout(mkr));\r\n marker.onMouseButtonEvent.addListener((mkr) => this.toggleMarker(mkr)); // eslint-disable-line @typescript-eslint/promise-function-async\r\n }\r\n\r\n this.updateMarkerVisibility();\r\n IModelApp.viewManager.addDecorator(this);\r\n }\r\n\r\n private onViewportChanged(changeFlags: ChangeFlags): void {\r\n if (this.viewport.iModel !== this._iModel) {\r\n this.dispose();\r\n return;\r\n }\r\n\r\n if (changeFlags.viewedCategories || changeFlags.viewedModels || changeFlags.viewedCategoriesPerModel)\r\n this.requestSync();\r\n\r\n if (changeFlags.viewState) {\r\n // If we're looking at a different view now, and we did not initiate that, turn off the active marker.\r\n if (this.viewport.view !== this._appliedSpatialView)\r\n this.setActiveMarker(undefined); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n else\r\n this._appliedSpatialView = undefined;\r\n }\r\n }\r\n\r\n private async toggleMarker(marker: SectionMarker): Promise<void> {\r\n await this.setActiveMarker(marker === this.activeMarker ? undefined : marker);\r\n }\r\n\r\n private dropTiledGraphicsProvider(): void {\r\n if (undefined === this._tiledGraphicsProvider)\r\n return;\r\n\r\n this.viewport.dropTiledGraphicsProvider(this._tiledGraphicsProvider);\r\n this._tiledGraphicsProvider = undefined;\r\n }\r\n\r\n /** @internal */\r\n public dispose(): void {\r\n if (!IModelApp.viewManager.dropDecorator(this))\r\n return;\r\n\r\n for (const remove of this._removeEventListeners)\r\n remove();\r\n\r\n this.dropTiledGraphicsProvider();\r\n }\r\n\r\n private showToolbarAfterTimeout(marker: SectionMarker): void {\r\n if (this._toolbarProvider?.marker !== marker)\r\n this._toolbarProvider = new MarkerToolbarProvider(marker, this);\r\n\r\n PopupToolbarManager.showToolbarAfterTimeout(this._toolbarProvider);\r\n }\r\n\r\n /** Toggles whether the clip volume associated with the specified marker is applied to the view. */\r\n public toggleClipVolume(marker: SectionMarker, enable: boolean): void {\r\n ViewClipTool.enableClipVolume(this.viewport);\r\n ViewClipTool.setViewClip(this.viewport, enable ? marker.state.clip : undefined);\r\n }\r\n\r\n /** Toggles the specified section marker.\r\n * Enabling the section applies the frustum and clip volume of the marker's spatial view to the viewport, and displays the 2d section graphics and sheet annotations.\r\n * Disabling the section disables the clip volume and 2d graphics.\r\n * @see [[toggleClipVolume]] to toggle only the clip volume.\r\n * @see [[toggleAttachment]] to toggle only the attachment graphics.\r\n */\r\n public async toggleSection(marker: SectionMarker, enable: boolean): Promise<boolean> {\r\n if (enable) {\r\n if (this.viewport.view.is3d()) {\r\n // Preserve the view settings; apply only the frustum and clip volume\r\n const spatialView = await marker.state.tryLoadSpatialView();\r\n if (!spatialView)\r\n return false;\r\n\r\n const aligned = await this.alignToSpatialView(marker);\r\n if (!aligned)\r\n return false;\r\n\r\n this.toggleClipVolume(marker, true);\r\n } else if (!await this.applySpatialView(marker)) {\r\n return false;\r\n }\r\n } else {\r\n this.toggleClipVolume(marker, false);\r\n }\r\n\r\n this.requestSync();\r\n return this.toggleAttachment(marker, enable);\r\n }\r\n\r\n /** Toggles display of 2d section graphics and sheet annotations for the specified marker.\r\n * @see [[toggleSection]] to apply the spatial view and clip volume in addition to the attachment graphics.\r\n */\r\n public async toggleAttachment(marker: SectionMarker, enable: boolean): Promise<boolean> {\r\n this.dropTiledGraphicsProvider();\r\n if (enable) {\r\n this._tiledGraphicsProvider = await createSectionGraphicsProvider(marker.state);\r\n this.viewport.addTiledGraphicsProvider(this._tiledGraphicsProvider);\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /** Aligns the viewport to face the specified marker's section plane. */\r\n public alignView(marker: SectionMarker): void {\r\n const placement = marker.state.placement.transform;\r\n const origin = placement.origin;\r\n const matrix = placement.matrix;\r\n\r\n const vp = this.viewport;\r\n const targetMatrix = matrix.multiplyMatrixMatrix(vp.rotation);\r\n const rotateTransform = Transform.createFixedPointAndMatrix(origin, targetMatrix);\r\n\r\n const startFrustum = vp.getFrustum();\r\n const newFrustum = startFrustum.clone();\r\n newFrustum.multiply(rotateTransform);\r\n\r\n if (startFrustum.equals(newFrustum))\r\n return;\r\n\r\n vp.view.setupFromFrustum(newFrustum);\r\n vp.synchWithView();\r\n vp.animateFrustumChange();\r\n }\r\n\r\n /** Opens the marker's drawing view in the decorator's viewport. Returns false if the drawing view could not be loaded. */\r\n public async openSection(marker: SectionMarker): Promise<boolean> {\r\n const viewState = await marker.state.tryLoadDrawingView();\r\n if (viewState)\r\n this.viewport.changeView(viewState);\r\n\r\n return undefined !== viewState;\r\n }\r\n\r\n /** Opens marker's sheet view in the decorator's viewport and zooms in on the associated [ViewAttachment]($backend). Returns false if no view\r\n * attachment exists or the sheet view could not be loaded.\r\n */\r\n public async openSheet(marker: SectionMarker): Promise<boolean> {\r\n if (undefined === marker.state.viewAttachment)\r\n return false;\r\n\r\n const viewState = await marker.state.tryLoadSheetView();\r\n if (!viewState)\r\n return false;\r\n\r\n this.viewport.changeView(viewState);\r\n await this.viewport.zoomToElements(marker.state.viewAttachment.id);\r\n return true;\r\n }\r\n\r\n /** Aligns the view to match the frustum of the spatial view associated with the specified marker.\r\n * @param marker The marker whose spatial view's frustum should be applied.\r\n * @returns false if the frustum could not be applied, e.g. because the spatial view could not be loaded or the viewport is viewing a 2d model.\r\n * @see [[alignView]] to align to the *section plane*, which may differ.\r\n * @see [[toggleSection]] to also apply the clip volume.\r\n */\r\n public async alignToSpatialView(marker: SectionMarker): Promise<boolean> {\r\n if (!this.viewport.view.is3d())\r\n return false;\r\n\r\n const spatialView = await marker.state.tryLoadSpatialView();\r\n if (!spatialView)\r\n return false;\r\n\r\n this.viewport.view.setOrigin(spatialView.getOrigin());\r\n this.viewport.view.setExtents(spatialView.getExtents());\r\n this.viewport.view.setRotation(spatialView.getRotation());\r\n this.viewport.synchWithView({ animateFrustumChange: true });\r\n\r\n return true;\r\n }\r\n\r\n /** Applies the marker's spatial view - including its clip volume - to the decorator's viewport.\r\n * Returns false if the spatial view could not be loaded.\r\n * @see [[toggleSection]].\r\n * @see [[toggleClipVolume]].\r\n */\r\n public async applySpatialView(marker: SectionMarker): Promise<boolean> {\r\n const viewState = await marker.state.tryLoadSpatialView();\r\n if (viewState) {\r\n this._appliedSpatialView = viewState;\r\n this.viewport.changeView(viewState);\r\n }\r\n\r\n return undefined !== viewState;\r\n }\r\n\r\n /** Request that the visibility of the section markers be recomputed. It is only necessary to call this if you have overridden [[SectionMarkerHandler.isMarkerVisible]]; if so, you should invoke\r\n * this method when the criteria governing your `isMarkerVisible` method have changed.\r\n */\r\n public requestSync(): void {\r\n if (this.syncImmediately) {\r\n this.sync();\r\n } else if (!this._needSync) {\r\n this._needSync = true;\r\n requestAnimationFrame(() => this.sync());\r\n }\r\n }\r\n\r\n private sync(): void {\r\n this._needSync = false;\r\n if (HyperModeling.isInitialized && this.viewport.view.is3d() && this.updateMarkerVisibility()) {\r\n this.markers.markDirty();\r\n this.viewport.invalidateCachedDecorations(this);\r\n }\r\n }\r\n\r\n private isMarkerVisible(marker: SectionMarker): boolean {\r\n if (undefined !== this.activeMarker)\r\n return marker === this.activeMarker;\r\n\r\n return HyperModeling.markerHandler.isMarkerVisible(marker, this, this._config);\r\n }\r\n\r\n private updateMarkerVisibility(): boolean {\r\n let changed = false;\r\n for (const marker of this.markers.markers) {\r\n const wasVisible = marker.visible;\r\n marker.visible = this.isMarkerVisible(marker);\r\n changed = changed || (marker.visible !== wasVisible);\r\n }\r\n\r\n return changed;\r\n }\r\n}\r\n"]}
|
package/lib/esm/PopupToolbar.js
CHANGED
|
@@ -13,7 +13,7 @@ class PopupToolbarManager {
|
|
|
13
13
|
if (!prov || !prov.overToolbarHotspot)
|
|
14
14
|
return false;
|
|
15
15
|
const admin = IModelApp.uiAdmin;
|
|
16
|
-
if (!admin.showToolbar(prov.toolbarProps, prov.toolbarLocation,
|
|
16
|
+
if (!admin.showToolbar(prov.toolbarProps, prov.toolbarLocation, { x: 0, y: 0 }, this._itemExecuted, this._cancel, undefined, prov.htmlElement))
|
|
17
17
|
return false;
|
|
18
18
|
this._current = this._provider;
|
|
19
19
|
this._provider = undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupToolbar.js","sourceRoot":"","sources":["../../src/PopupToolbar.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAIH,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAWjD,gBAAgB;AAChB,MAAa,mBAAmB;IAItB,MAAM,CAAC,IAAI;QACjB,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC;QAC5B,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,kBAAkB;YACnC,OAAO,KAAK,CAAC;QAEf,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC;QAChC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"PopupToolbar.js","sourceRoot":"","sources":["../../src/PopupToolbar.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAIH,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAWjD,gBAAgB;AAChB,MAAa,mBAAmB;IAItB,MAAM,CAAC,IAAI;QACjB,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC;QAC5B,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,kBAAkB;YACnC,OAAO,KAAK,CAAC;QAEf,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC;QAChC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,eAAe,EAAE,EAAE,CAAC,EAAE,CAAC,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IAE9C,GAAG,CAAC,KAAK,EAAE,CAAC;AACd,CAAC,CAAC;AAEa,2BAAO,GAAG,GAAG,EAAE;IAC5B,MAAM,GAAG,GAAG,mBAAmB,CAAC;IAChC,IAAI,CAAC,GAAG,CAAC,QAAQ,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,kBAAkB;QACnD,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,wCAAwC;AACzD,CAAC,CAAC;SA/BS,mBAAmB","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/** @packageDocumentation\r\n * @module HyperModeling\r\n */\r\n\r\nimport { XAndY } from \"@itwin/core-geometry\";\r\nimport type { AbstractToolbarProps } from \"@itwin/appui-abstract\";\r\nimport { IModelApp } from \"@itwin/core-frontend\";\r\n\r\n/** @internal */\r\nexport interface PopupToolbarProvider {\r\n toolbarProps: AbstractToolbarProps;\r\n overToolbarHotspot: boolean;\r\n toolbarLocation: XAndY;\r\n htmlElement: HTMLElement | undefined;\r\n onToolbarItemExecuted(id: string): void;\r\n}\r\n\r\n/** @internal */\r\nexport class PopupToolbarManager {\r\n private static _provider?: PopupToolbarProvider;\r\n private static _current?: PopupToolbarProvider;\r\n\r\n private static show(): boolean {\r\n const prov = this._provider;\r\n if (!prov || !prov.overToolbarHotspot)\r\n return false;\r\n\r\n const admin = IModelApp.uiAdmin;\r\n if (!admin.showToolbar(prov.toolbarProps, prov.toolbarLocation, { x: 0, y: 0 }, this._itemExecuted, this._cancel, undefined, prov.htmlElement))\r\n return false;\r\n\r\n this._current = this._provider;\r\n this._provider = undefined;\r\n this.closeAfterTimeout();\r\n return true;\r\n }\r\n\r\n private static _itemExecuted = (item: any) => {\r\n const mgr = PopupToolbarManager;\r\n if (mgr._current)\r\n mgr._current.onToolbarItemExecuted(item.id);\r\n\r\n mgr.close();\r\n };\r\n\r\n private static _cancel = () => {\r\n const mgr = PopupToolbarManager;\r\n if (!mgr._current || !mgr._current.overToolbarHotspot)\r\n mgr.close(); // Don't hide when click is over hotspot\r\n };\r\n\r\n private static close(): boolean {\r\n this._current = undefined;\r\n return IModelApp.uiAdmin.hideToolbar();\r\n }\r\n\r\n private static closeAfterTimeout(): void {\r\n if (!this._current)\r\n return;\r\n\r\n const delay = 1000;\r\n if (this._current.overToolbarHotspot || !IModelApp.toolAdmin.cursorView)\r\n setTimeout(() => this.closeAfterTimeout(), delay); // Cursor not in view or over hotspot, check again\r\n else\r\n this.close();\r\n }\r\n\r\n public static showToolbarAfterTimeout(provider: PopupToolbarProvider): void {\r\n if (this._current === provider)\r\n return;\r\n\r\n this._provider = provider;\r\n setTimeout(() => this.show(), 500);\r\n }\r\n}\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/hypermodeling-frontend",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0-dev.0",
|
|
4
4
|
"description": "iTwin.js hypermodeling package",
|
|
5
5
|
"main": "lib/cjs/hypermodeling-frontend.js",
|
|
6
6
|
"module": "lib/esm/hypermodeling-frontend.js",
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"url": "http://www.bentley.com"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@itwin/core-bentley": "^4.
|
|
26
|
-
"@itwin/core-common": "^4.
|
|
27
|
-
"@itwin/core-frontend": "^4.
|
|
28
|
-
"@itwin/core-geometry": "^4.
|
|
25
|
+
"@itwin/core-bentley": "^4.3.0-dev.0",
|
|
26
|
+
"@itwin/core-common": "^4.3.0-dev.0",
|
|
27
|
+
"@itwin/core-frontend": "^4.3.0-dev.0",
|
|
28
|
+
"@itwin/core-geometry": "^4.3.0-dev.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@itwin/eslint-plugin": "4.0.0-dev.44",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@types/node": "18.16.1",
|
|
35
35
|
"babel-loader": "~8.2.5",
|
|
36
36
|
"babel-plugin-istanbul": "~6.1.1",
|
|
37
|
-
"chai": "^4.
|
|
37
|
+
"chai": "^4.3.10",
|
|
38
38
|
"cpx2": "^3.0.0",
|
|
39
39
|
"eslint": "^8.44.0",
|
|
40
40
|
"glob": "^7.1.2",
|
|
@@ -44,15 +44,15 @@
|
|
|
44
44
|
"source-map-loader": "^4.0.0",
|
|
45
45
|
"typescript": "~5.0.2",
|
|
46
46
|
"webpack": "^5.76.0",
|
|
47
|
-
"@itwin/
|
|
48
|
-
"@itwin/core-
|
|
49
|
-
"@itwin/
|
|
50
|
-
"@itwin/core-
|
|
51
|
-
"@itwin/
|
|
52
|
-
"@itwin/
|
|
47
|
+
"@itwin/core-frontend": "4.3.0-dev.0",
|
|
48
|
+
"@itwin/core-common": "4.3.0-dev.0",
|
|
49
|
+
"@itwin/build-tools": "4.3.0-dev.0",
|
|
50
|
+
"@itwin/core-bentley": "4.3.0-dev.0",
|
|
51
|
+
"@itwin/core-geometry": "4.3.0-dev.0",
|
|
52
|
+
"@itwin/certa": "4.3.0-dev.0"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@itwin/appui-abstract": "4.
|
|
55
|
+
"@itwin/appui-abstract": "4.3.0-dev.0"
|
|
56
56
|
},
|
|
57
57
|
"nyc": {
|
|
58
58
|
"extends": "./node_modules/@itwin/build-tools/.nycrc"
|