@itwin/saved-views-react 1.2.4 → 1.2.6

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.
@@ -7,7 +7,7 @@ interface LayeredDropdownMenuProps {
7
7
  */
8
8
  menuItems: ReactElement[] | ((close: () => void) => ReactElement[]);
9
9
  /** Dropdown menu trigger to pass to iTwinUI `<DropdownMenu />` component. */
10
- children: ReactNode;
10
+ children: React.JSX.Element;
11
11
  }
12
12
  /**
13
13
  * An extended version of iTwinUI `<DropdownMenu />` component with support for layered dropdown menu items.
@@ -26,9 +26,16 @@ function applyCameraOptions(seedViewStateProps, _iModel, viewport, savedViewData
26
26
  viewDef.angles = YawPitchRollAngles.createFromMatrix3d(cameraProps.rotation)?.toJSON();
27
27
  viewDef.camera = cameraProps.camera;
28
28
  }
29
- else {
29
+ else if (!(cameraProps instanceof ViewPose)) {
30
30
  const cameraProps3d = cameraProps;
31
- viewDef.cameraOn = cameraProps3d.camera !== undefined;
31
+ // cameraOn property only exists on ViewDefinitionProps (from viewport),
32
+ // not on ViewData/ViewITwin3d. For saved view data, infer from camera presence.
33
+ if (settings.camera === "keep") {
34
+ viewDef.cameraOn = cameraProps.cameraOn ?? false;
35
+ }
36
+ else {
37
+ viewDef.cameraOn = cameraProps3d.camera !== undefined;
38
+ }
32
39
  viewDef.origin = cameraProps3d.origin;
33
40
  viewDef.extents = cameraProps3d.extents;
34
41
  viewDef.angles = cameraProps3d.angles;
@@ -82,7 +89,7 @@ async function applyViewStateProps(viewStateProps, iModel, viewport, savedViewDa
82
89
  });
83
90
  viewport.changeView(viewState, settings.viewChangeOptions);
84
91
  if (settings.subcategories !== "ignore") {
85
- // If subcategories are not ignored, we need to reset them here,
92
+ // If subcategories are not ignored, we need to reset them here,
86
93
  // otherwise we might end up with subcategories not shown correctly
87
94
  const { addCategories, dropCategories } = await sortCategories(iModel, savedViewData.viewData, categories);
88
95
  viewport.changeCategoryDisplay(dropCategories, false);
@@ -138,7 +138,7 @@ function createSheetSavedViewObject(vp, hiddenCategories) {
138
138
  },
139
139
  width: viewState.sheetSize.x,
140
140
  height: viewState.sheetSize.y,
141
- sheetAttachments: viewState.attachmentIds,
141
+ sheetAttachments: [...viewState.attachmentIds],
142
142
  viewDetails: extractViewDetails2dFromLegacy(viewDefinitionProps),
143
143
  };
144
144
  }
@@ -4,6 +4,7 @@ import type { DisplayStyle3dSettingsProps, DisplayStyleSettingsProps } from "@it
4
4
  import { type ExtractionFunc } from "./extractionUtilities.js";
5
5
  export declare const featureAppearanceMappings: ExtractionFunc<void, void>[];
6
6
  export declare const featureAppearanceLegacyMappings: ExtractionFunc<void, void>[];
7
+ export declare const realityModelDisplayMappings: ExtractionFunc<void, void>[];
7
8
  /**
8
9
  * Extracts the display style from a legacy view displayStyle field
9
10
  * And transforms it into our schema
@@ -133,6 +133,28 @@ const displayStyleModelAppearanceLegacyMappings = [
133
133
  ...featureAppearanceLegacyMappings,
134
134
  extractString("modelId"),
135
135
  ];
136
+ export const realityModelDisplayMappings = [
137
+ extractObject([
138
+ extractString("sizeMode"),
139
+ extractNumber("voxelScale"),
140
+ extractNumber("minPixelsPerVoxel"),
141
+ extractNumber("maxPixelsPerVoxel"),
142
+ extractNumber("pixelSize"),
143
+ extractString("shape"),
144
+ extractString("edlMode"),
145
+ extractNumber("edlStrength"),
146
+ extractNumber("edlRadius"),
147
+ extractNumber("edlFilter"),
148
+ extractNumber("edlMixWts1"),
149
+ extractNumber("edlMixWts2"),
150
+ extractNumber("edlMixWts4"),
151
+ ], "pointCloud"),
152
+ extractNumber("overrideColorRatio"),
153
+ ];
154
+ const displayStyleRealityModelDisplayMappings = [
155
+ ...realityModelDisplayMappings,
156
+ extractString("modelId"),
157
+ ];
136
158
  const contextRealityModelsMappings = [
137
159
  extractObject([
138
160
  extractString("provider"),
@@ -157,6 +179,7 @@ const contextRealityModelsMappings = [
157
179
  ], "classifiers"),
158
180
  extractObject(planarClipMaskMappings, "planarClipMask"),
159
181
  extractObject(featureAppearanceMappings, "appearanceOverrides"),
182
+ extractObject(realityModelDisplayMappings, "displaySettings"),
160
183
  ];
161
184
  const contextRealityModelsLegacyMappings = [
162
185
  extractObject([
@@ -182,6 +205,7 @@ const contextRealityModelsLegacyMappings = [
182
205
  ], "classifiers"),
183
206
  extractObject(planarClipMaskMappings, "planarClipMask"),
184
207
  extractObject(featureAppearanceLegacyMappings, "appearanceOverrides"),
208
+ extractObject(realityModelDisplayMappings, "displaySettings"),
185
209
  ];
186
210
  const commonMapLayerPropsMapping = [
187
211
  extractBoolean("visible"),
@@ -401,6 +425,7 @@ const displayStylesMapping = [
401
425
  extractStringOrArray("excludedElements"),
402
426
  extractObject(mapImageryMapping, "mapImagery"),
403
427
  extractArray(displayStyleModelAppearanceMappings, "modelOverrides", "modelOvr"),
428
+ extractArray(displayStyleRealityModelDisplayMappings, "realityModelDisplay"),
404
429
  extractObject(clipStyleMappings, "clipStyle"),
405
430
  extractArray(displayStylePlanarClipMaskMappings, "planarClipOverrides", "planarClipOvr"),
406
431
  ];
@@ -417,6 +442,7 @@ const displayStylesLegacyMapping = [
417
442
  extractStringOrArray("excludedElements"),
418
443
  extractObject(mapImageryLegacyMapping, "mapImagery"),
419
444
  extractArray(displayStyleModelAppearanceLegacyMappings, "modelOvr", "modelOverrides"),
445
+ extractArrayElementsConditionally((value) => value && !value.invisible, displayStyleRealityModelDisplayMappings, "realityModelDisplay"),
420
446
  extractObject(clipStyleLegacyMappings, "clipStyle"),
421
447
  extractArray(displayStylePlanarClipMaskMappings, "planarClipOvr", "planarClipOverrides"),
422
448
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/saved-views-react",
3
- "version": "1.2.4",
3
+ "version": "1.2.6",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -49,7 +49,7 @@
49
49
  "react-dom": "^18.0.0",
50
50
  "recursive-readdir": "^2.2.3",
51
51
  "typescript": "^5.5.4",
52
- "vite": "^6.0.0",
52
+ "vite": "^6.4.1",
53
53
  "vitest": "^4.0.16"
54
54
  },
55
55
  "peerDependencies": {
@@ -66,7 +66,7 @@
66
66
  "@itwin/itwinui-icons-react": "^2.9.0",
67
67
  "@itwin/itwinui-react": "^3.15.0",
68
68
  "fuse.js": "^6.6.2",
69
- "@itwin/saved-views-client": "^0.6.2"
69
+ "@itwin/saved-views-client": "^0.6.4"
70
70
  },
71
71
  "scripts": {
72
72
  "build": "run-p build:*",