Skip to content

Commit 81af88d

Browse files
committed
Add changes to support scenes app
1 parent fe5f948 commit 81af88d

8 files changed

Lines changed: 777 additions & 10 deletions

File tree

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@
5959
"vite": "^7.0.1",
6060
"vite-plugin-static-copy": "^3.1.0"
6161
},
62+
"overrides": {
63+
"lodash": "^4.17.23",
64+
"seroval": "^1.5.0"
65+
},
6266
"scripts": {
6367
"build": "tsc -b && vite build",
6468
"lint": "eslint .",

src/components/App.tsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
import {
1414
FitViewTool,
1515
IModelApp,
16+
IModelConnection,
1617
type ScreenViewport,
1718
StandardViewId,
1819
} from "@itwin/core-frontend";
@@ -25,8 +26,11 @@ import {
2526
MeasureToolsUiItemsProvider,
2627
} from "@itwin/measure-tools-react";
2728
import { selectionStorage } from "../selectionStorage";
28-
import { propertyGridUiProvider, treeWidgetUiProvider } from "./UiProviders";
29+
import { propertyGridUiProvider } from "./UiProviders";
2930
import { useAuthorizationContext } from "./Authorization";
31+
import { ScenesWidgetProvider } from "./ScenesWidget";
32+
import { ScenesClient } from "./ScenesClient";
33+
import { ScenesCache } from "./ScenesCache";
3034

3135
interface AppProps {
3236
iTwinId: string;
@@ -45,6 +49,15 @@ export function App({ iTwinId, iModelId, changesetId }: AppProps) {
4549
MeasurementActionToolbar.setDefaultActionProvider();
4650
}, []);
4751

52+
const onIModelReady = useCallback(
53+
async (iModelConnection: IModelConnection) => {
54+
// Populate the information needed for this app.
55+
await ScenesClient.populateContext(iModelConnection);
56+
await ScenesCache.populateRealityModels(iModelConnection);
57+
},
58+
[],
59+
);
60+
4861
return (
4962
<Viewer
5063
iTwinId={iTwinId}
@@ -54,13 +67,15 @@ export function App({ iTwinId, iModelId, changesetId }: AppProps) {
5467
viewCreatorOptions={viewCreatorOptions}
5568
enablePerformanceMonitors={true} // see description in the README (https://www.npmjs.com/package/@itwin/web-viewer-react)
5669
onIModelAppInit={onIModelAppInit}
70+
onIModelConnected={onIModelReady}
5771
mapLayerOptions={{
5872
BingMaps: {
5973
key: "key",
6074
value: import.meta.env.IMJS_BING_MAPS_KEY ?? "",
6175
},
6276
}}
6377
uiProviders={[
78+
new ScenesWidgetProvider(),
6479
new ViewerNavigationToolsProvider(),
6580
new ViewerContentToolsProvider({
6681
vertical: {
@@ -69,7 +84,6 @@ export function App({ iTwinId, iModelId, changesetId }: AppProps) {
6984
}),
7085
new ViewerStatusbarItemsProvider(),
7186
new MeasureToolsUiItemsProvider(),
72-
treeWidgetUiProvider,
7387
propertyGridUiProvider,
7488
]}
7589
selectionStorage={selectionStorage}
@@ -96,7 +110,7 @@ function viewConfiguration(viewPort: ScreenViewport) {
96110
ViewerPerformance.addMeasure(
97111
"TileTreesLoaded",
98112
"ViewerStarting",
99-
"TilesLoaded"
113+
"TilesLoaded",
100114
);
101115
clearInterval(intvl);
102116
resolve(true);

src/components/Scenes.scss

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3+
* See LICENSE.md in the project root for license terms and full copyright notice.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
.scenes-wrapper {
7+
display: flex;
8+
flex-direction: column;
9+
width: 100%;
10+
height: 100%;
11+
margin: 0 auto;
12+
padding: 8px;
13+
box-sizing: border-box;
14+
15+
.scenes-banner {
16+
flex: none;
17+
}
18+
19+
.scenes-controls {
20+
height: 40px;
21+
flex: none;
22+
display: flex;
23+
flex-direction: row;
24+
justify-content: flex-start;
25+
gap: 10px;
26+
padding-top: 5px;
27+
padding-bottom: 5px;
28+
}
29+
30+
.scenes-tile-list {
31+
flex: auto;
32+
overflow-y: auto;
33+
}
34+
35+
.scenes-group {
36+
margin-left: 10px;
37+
}
38+
39+
.scenes-tile {
40+
width: -webkit-fill-available;
41+
margin-bottom: 10px;
42+
margin-right: 5px;
43+
}
44+
45+
.scenes-tile-div {
46+
cursor: pointer;
47+
}
48+
}

0 commit comments

Comments
 (0)