@itwin/map-layers 4.0.0-dev.44 → 4.0.0-dev.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/CHANGELOG.md +864 -864
  2. package/README.md +32 -32
  3. package/lib/cjs/MapLayerPreferences.d.ts +88 -88
  4. package/lib/cjs/MapLayerPreferences.js +311 -311
  5. package/lib/cjs/MapLayerPreferences.js.map +1 -1
  6. package/lib/cjs/map-layers.d.ts +6 -6
  7. package/lib/cjs/map-layers.js +22 -22
  8. package/lib/cjs/mapLayers.d.ts +26 -44
  9. package/lib/cjs/mapLayers.d.ts.map +1 -1
  10. package/lib/cjs/mapLayers.js +33 -61
  11. package/lib/cjs/mapLayers.js.map +1 -1
  12. package/lib/cjs/ui/FeatureInfoUiItemsProvider.d.ts +16 -11
  13. package/lib/cjs/ui/FeatureInfoUiItemsProvider.d.ts.map +1 -1
  14. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js +46 -51
  15. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  16. package/lib/cjs/ui/Interfaces.d.ts +50 -50
  17. package/lib/cjs/ui/Interfaces.js +2 -2
  18. package/lib/cjs/ui/Interfaces.js.map +1 -1
  19. package/lib/cjs/ui/MapFeatureInfoTool.d.ts +13 -13
  20. package/lib/cjs/ui/MapFeatureInfoTool.js +50 -50
  21. package/lib/cjs/ui/MapFeatureInfoTool.js.map +1 -1
  22. package/lib/cjs/ui/MapLayersUiItemsProvider.d.ts +8 -8
  23. package/lib/cjs/ui/MapLayersUiItemsProvider.d.ts.map +1 -1
  24. package/lib/cjs/ui/MapLayersUiItemsProvider.js +35 -38
  25. package/lib/cjs/ui/MapLayersUiItemsProvider.js.map +1 -1
  26. package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts +13 -14
  27. package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
  28. package/lib/cjs/ui/widget/AttachLayerPopupButton.js +335 -335
  29. package/lib/cjs/ui/widget/BasemapPanel.d.ts +7 -8
  30. package/lib/cjs/ui/widget/BasemapPanel.d.ts.map +1 -1
  31. package/lib/cjs/ui/widget/BasemapPanel.js +156 -156
  32. package/lib/cjs/ui/widget/BasemapPanel.js.map +1 -1
  33. package/lib/cjs/ui/widget/BasemapPanel.scss +87 -87
  34. package/lib/cjs/ui/widget/ConfirmMessageDialog.d.ts +20 -21
  35. package/lib/cjs/ui/widget/ConfirmMessageDialog.d.ts.map +1 -1
  36. package/lib/cjs/ui/widget/ConfirmMessageDialog.js +22 -22
  37. package/lib/cjs/ui/widget/ConfirmMessageDialog.js.map +1 -1
  38. package/lib/cjs/ui/widget/FeatureInfoDataProvider.d.ts +40 -40
  39. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js +138 -138
  40. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  41. package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts +6 -7
  42. package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
  43. package/lib/cjs/ui/widget/FeatureInfoWidget.js +65 -65
  44. package/lib/cjs/ui/widget/FeatureInfoWidget.js.map +1 -1
  45. package/lib/cjs/ui/widget/MapLayerDroppable.d.ts +18 -19
  46. package/lib/cjs/ui/widget/MapLayerDroppable.d.ts.map +1 -1
  47. package/lib/cjs/ui/widget/MapLayerDroppable.js +85 -85
  48. package/lib/cjs/ui/widget/MapLayerDroppable.js.map +1 -1
  49. package/lib/cjs/ui/widget/MapLayerManager.d.ts +26 -26
  50. package/lib/cjs/ui/widget/MapLayerManager.js +401 -401
  51. package/lib/cjs/ui/widget/MapLayerManager.js.map +1 -1
  52. package/lib/cjs/ui/widget/MapLayerManager.scss +409 -409
  53. package/lib/cjs/ui/widget/MapLayerSettingsMenu.d.ts +11 -12
  54. package/lib/cjs/ui/widget/MapLayerSettingsMenu.d.ts.map +1 -1
  55. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js +82 -82
  56. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  57. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.d.ts +6 -7
  58. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.d.ts.map +1 -1
  59. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js +65 -65
  60. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  61. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.scss +20 -20
  62. package/lib/cjs/ui/widget/MapLayersWidget.d.ts +10 -11
  63. package/lib/cjs/ui/widget/MapLayersWidget.d.ts.map +1 -1
  64. package/lib/cjs/ui/widget/MapLayersWidget.js +31 -31
  65. package/lib/cjs/ui/widget/MapLayersWidget.js.map +1 -1
  66. package/lib/cjs/ui/widget/MapManagerSettings.d.ts +2 -3
  67. package/lib/cjs/ui/widget/MapManagerSettings.d.ts.map +1 -1
  68. package/lib/cjs/ui/widget/MapManagerSettings.js +200 -200
  69. package/lib/cjs/ui/widget/MapManagerSettings.js.map +1 -1
  70. package/lib/cjs/ui/widget/MapManagerSettings.scss +29 -29
  71. package/lib/cjs/ui/widget/MapUrlDialog.d.ts +22 -23
  72. package/lib/cjs/ui/widget/MapUrlDialog.d.ts.map +1 -1
  73. package/lib/cjs/ui/widget/MapUrlDialog.js +530 -530
  74. package/lib/cjs/ui/widget/MapUrlDialog.js.map +1 -1
  75. package/lib/cjs/ui/widget/MapUrlDialog.scss +99 -100
  76. package/lib/cjs/ui/widget/SelectMapFormat.d.ts +17 -18
  77. package/lib/cjs/ui/widget/SelectMapFormat.d.ts.map +1 -1
  78. package/lib/cjs/ui/widget/SelectMapFormat.js +54 -54
  79. package/lib/cjs/ui/widget/SelectMapFormat.js.map +1 -1
  80. package/lib/cjs/ui/widget/SubLayersDataProvider.d.ts +18 -20
  81. package/lib/cjs/ui/widget/SubLayersDataProvider.d.ts.map +1 -1
  82. package/lib/cjs/ui/widget/SubLayersDataProvider.js +74 -75
  83. package/lib/cjs/ui/widget/SubLayersDataProvider.js.map +1 -1
  84. package/lib/cjs/ui/widget/SubLayersPopupButton.d.ts +9 -10
  85. package/lib/cjs/ui/widget/SubLayersPopupButton.d.ts.map +1 -1
  86. package/lib/cjs/ui/widget/SubLayersPopupButton.js +40 -40
  87. package/lib/cjs/ui/widget/SubLayersPopupButton.js.map +1 -1
  88. package/lib/cjs/ui/widget/SubLayersTree.d.ts +14 -15
  89. package/lib/cjs/ui/widget/SubLayersTree.d.ts.map +1 -1
  90. package/lib/cjs/ui/widget/SubLayersTree.js +413 -413
  91. package/lib/cjs/ui/widget/SubLayersTree.js.map +1 -1
  92. package/lib/cjs/ui/widget/SubLayersTree.scss +70 -69
  93. package/lib/cjs/ui/widget/TransparencyPopupButton.d.ts +13 -14
  94. package/lib/cjs/ui/widget/TransparencyPopupButton.d.ts.map +1 -1
  95. package/lib/cjs/ui/widget/TransparencyPopupButton.js +47 -47
  96. package/lib/cjs/ui/widget/TransparencyPopupButton.js.map +1 -1
  97. package/lib/cjs/ui/widget/TransparencyPopupButton.scss +35 -36
  98. package/lib/esm/MapLayerPreferences.d.ts +88 -88
  99. package/lib/esm/MapLayerPreferences.js +307 -307
  100. package/lib/esm/MapLayerPreferences.js.map +1 -1
  101. package/lib/esm/map-layers.d.ts +6 -6
  102. package/lib/esm/map-layers.js +10 -10
  103. package/lib/esm/mapLayers.d.ts +26 -44
  104. package/lib/esm/mapLayers.d.ts.map +1 -1
  105. package/lib/esm/mapLayers.js +29 -57
  106. package/lib/esm/mapLayers.js.map +1 -1
  107. package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts +16 -11
  108. package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts.map +1 -1
  109. package/lib/esm/ui/FeatureInfoUiItemsProvider.js +42 -47
  110. package/lib/esm/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  111. package/lib/esm/ui/Interfaces.d.ts +50 -50
  112. package/lib/esm/ui/Interfaces.js +1 -1
  113. package/lib/esm/ui/Interfaces.js.map +1 -1
  114. package/lib/esm/ui/MapFeatureInfoTool.d.ts +13 -13
  115. package/lib/esm/ui/MapFeatureInfoTool.js +45 -45
  116. package/lib/esm/ui/MapFeatureInfoTool.js.map +1 -1
  117. package/lib/esm/ui/MapLayersUiItemsProvider.d.ts +8 -8
  118. package/lib/esm/ui/MapLayersUiItemsProvider.d.ts.map +1 -1
  119. package/lib/esm/ui/MapLayersUiItemsProvider.js +31 -34
  120. package/lib/esm/ui/MapLayersUiItemsProvider.js.map +1 -1
  121. package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts +13 -14
  122. package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
  123. package/lib/esm/ui/widget/AttachLayerPopupButton.js +331 -331
  124. package/lib/esm/ui/widget/BasemapPanel.d.ts +7 -8
  125. package/lib/esm/ui/widget/BasemapPanel.d.ts.map +1 -1
  126. package/lib/esm/ui/widget/BasemapPanel.js +152 -152
  127. package/lib/esm/ui/widget/BasemapPanel.js.map +1 -1
  128. package/lib/esm/ui/widget/BasemapPanel.scss +87 -87
  129. package/lib/esm/ui/widget/ConfirmMessageDialog.d.ts +20 -21
  130. package/lib/esm/ui/widget/ConfirmMessageDialog.d.ts.map +1 -1
  131. package/lib/esm/ui/widget/ConfirmMessageDialog.js +18 -18
  132. package/lib/esm/ui/widget/ConfirmMessageDialog.js.map +1 -1
  133. package/lib/esm/ui/widget/FeatureInfoDataProvider.d.ts +40 -40
  134. package/lib/esm/ui/widget/FeatureInfoDataProvider.js +134 -134
  135. package/lib/esm/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  136. package/lib/esm/ui/widget/FeatureInfoWidget.d.ts +6 -7
  137. package/lib/esm/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
  138. package/lib/esm/ui/widget/FeatureInfoWidget.js +61 -61
  139. package/lib/esm/ui/widget/FeatureInfoWidget.js.map +1 -1
  140. package/lib/esm/ui/widget/MapLayerDroppable.d.ts +18 -19
  141. package/lib/esm/ui/widget/MapLayerDroppable.d.ts.map +1 -1
  142. package/lib/esm/ui/widget/MapLayerDroppable.js +81 -81
  143. package/lib/esm/ui/widget/MapLayerDroppable.js.map +1 -1
  144. package/lib/esm/ui/widget/MapLayerManager.d.ts +26 -26
  145. package/lib/esm/ui/widget/MapLayerManager.js +396 -396
  146. package/lib/esm/ui/widget/MapLayerManager.js.map +1 -1
  147. package/lib/esm/ui/widget/MapLayerManager.scss +409 -409
  148. package/lib/esm/ui/widget/MapLayerSettingsMenu.d.ts +11 -12
  149. package/lib/esm/ui/widget/MapLayerSettingsMenu.d.ts.map +1 -1
  150. package/lib/esm/ui/widget/MapLayerSettingsMenu.js +78 -78
  151. package/lib/esm/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  152. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.d.ts +6 -7
  153. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.d.ts.map +1 -1
  154. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js +61 -61
  155. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  156. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.scss +20 -20
  157. package/lib/esm/ui/widget/MapLayersWidget.d.ts +10 -11
  158. package/lib/esm/ui/widget/MapLayersWidget.d.ts.map +1 -1
  159. package/lib/esm/ui/widget/MapLayersWidget.js +27 -27
  160. package/lib/esm/ui/widget/MapLayersWidget.js.map +1 -1
  161. package/lib/esm/ui/widget/MapManagerSettings.d.ts +2 -3
  162. package/lib/esm/ui/widget/MapManagerSettings.d.ts.map +1 -1
  163. package/lib/esm/ui/widget/MapManagerSettings.js +196 -196
  164. package/lib/esm/ui/widget/MapManagerSettings.js.map +1 -1
  165. package/lib/esm/ui/widget/MapManagerSettings.scss +29 -29
  166. package/lib/esm/ui/widget/MapUrlDialog.d.ts +22 -23
  167. package/lib/esm/ui/widget/MapUrlDialog.d.ts.map +1 -1
  168. package/lib/esm/ui/widget/MapUrlDialog.js +526 -526
  169. package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
  170. package/lib/esm/ui/widget/MapUrlDialog.scss +99 -100
  171. package/lib/esm/ui/widget/SelectMapFormat.d.ts +17 -18
  172. package/lib/esm/ui/widget/SelectMapFormat.d.ts.map +1 -1
  173. package/lib/esm/ui/widget/SelectMapFormat.js +50 -50
  174. package/lib/esm/ui/widget/SelectMapFormat.js.map +1 -1
  175. package/lib/esm/ui/widget/SubLayersDataProvider.d.ts +18 -20
  176. package/lib/esm/ui/widget/SubLayersDataProvider.d.ts.map +1 -1
  177. package/lib/esm/ui/widget/SubLayersDataProvider.js +70 -71
  178. package/lib/esm/ui/widget/SubLayersDataProvider.js.map +1 -1
  179. package/lib/esm/ui/widget/SubLayersPopupButton.d.ts +9 -10
  180. package/lib/esm/ui/widget/SubLayersPopupButton.d.ts.map +1 -1
  181. package/lib/esm/ui/widget/SubLayersPopupButton.js +36 -36
  182. package/lib/esm/ui/widget/SubLayersPopupButton.js.map +1 -1
  183. package/lib/esm/ui/widget/SubLayersTree.d.ts +14 -15
  184. package/lib/esm/ui/widget/SubLayersTree.d.ts.map +1 -1
  185. package/lib/esm/ui/widget/SubLayersTree.js +408 -408
  186. package/lib/esm/ui/widget/SubLayersTree.js.map +1 -1
  187. package/lib/esm/ui/widget/SubLayersTree.scss +70 -69
  188. package/lib/esm/ui/widget/TransparencyPopupButton.d.ts +13 -14
  189. package/lib/esm/ui/widget/TransparencyPopupButton.d.ts.map +1 -1
  190. package/lib/esm/ui/widget/TransparencyPopupButton.js +43 -43
  191. package/lib/esm/ui/widget/TransparencyPopupButton.js.map +1 -1
  192. package/lib/esm/ui/widget/TransparencyPopupButton.scss +35 -36
  193. package/package.json +28 -34
@@ -1,9 +1,8 @@
1
- /// <reference types="react" />
2
- import "./BasemapPanel.scss";
3
- interface BasemapPanelProps {
4
- disabled?: boolean;
5
- }
6
- /** @internal */
7
- export declare function BasemapPanel(props: BasemapPanelProps): JSX.Element;
8
- export {};
1
+ import "./BasemapPanel.scss";
2
+ interface BasemapPanelProps {
3
+ disabled?: boolean;
4
+ }
5
+ /** @internal */
6
+ export declare function BasemapPanel(props: BasemapPanelProps): JSX.Element;
7
+ export {};
9
8
  //# sourceMappingURL=BasemapPanel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BasemapPanel.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/BasemapPanel.tsx"],"names":[],"mappings":";AAeA,OAAO,qBAAqB,CAAC;AAc7B,UAAU,iBAAiB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,gBAAgB;AAEhB,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,eAwJpD"}
1
+ {"version":3,"file":"BasemapPanel.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/BasemapPanel.tsx"],"names":[],"mappings":"AAeA,OAAO,qBAAqB,CAAC;AAc7B,UAAU,iBAAiB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,gBAAgB;AAEhB,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,eAwJpD"}
@@ -1,153 +1,153 @@
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
- /* eslint-disable deprecation/deprecation */
6
- // cSpell:ignore droppable Sublayer Basemap
7
- import { UiFramework } from "@itwin/appui-react";
8
- import { BaseMapLayerSettings, ColorByName, ColorDef, ImageMapLayerSettings } from "@itwin/core-common";
9
- import { WebFontIcon } from "@itwin/core-react";
10
- import { ColorPickerDialog, ColorSwatch } from "@itwin/imodel-components-react";
11
- import { Button, Select } from "@itwin/itwinui-react";
12
- import * as React from "react";
13
- import { MapLayersUI } from "../../mapLayers";
14
- import "./BasemapPanel.scss";
15
- import { useSourceMapContext } from "./MapLayerManager";
16
- import { TransparencyPopupButton } from "./TransparencyPopupButton";
17
- function getBaseMapFromStyle(displayStyle) {
18
- if (!displayStyle)
19
- return undefined;
20
- if (displayStyle.settings.mapImagery.backgroundBase instanceof ImageMapLayerSettings || displayStyle.settings.mapImagery.backgroundBase instanceof ColorDef)
21
- return displayStyle.settings.mapImagery.backgroundBase.toJSON();
22
- return undefined;
23
- }
24
- /** @internal */
25
- // eslint-disable-next-line @typescript-eslint/naming-convention
26
- export function BasemapPanel(props) {
27
- const [useColorLabel] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:Basemap.ColorFill"));
28
- const { activeViewport, bases } = useSourceMapContext();
29
- const [selectedBaseMap, setSelectedBaseMap] = React.useState(getBaseMapFromStyle(activeViewport?.displayStyle));
30
- const [baseMapTransparencyValue, setBaseMapTransparencyValue] = React.useState(() => {
31
- if (activeViewport)
32
- return activeViewport.displayStyle.baseMapTransparency;
33
- return 0;
34
- });
35
- const [baseMapVisible, setBaseMapVisible] = React.useState(() => {
36
- if (activeViewport && activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings) {
37
- return activeViewport.displayStyle.backgroundMapBase.visible;
38
- }
39
- return false;
40
- });
41
- // Monitor viewport updates, and refresh the widget accordingly.
42
- // Note: This is needed for multiple viewport applications.
43
- React.useEffect(() => {
44
- if (activeViewport) {
45
- setBaseMapTransparencyValue(activeViewport.displayStyle.baseMapTransparency);
46
- setSelectedBaseMap(getBaseMapFromStyle(activeViewport.displayStyle));
47
- if (activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings) {
48
- setBaseMapVisible(activeViewport.displayStyle.backgroundMapBase.visible);
49
- }
50
- }
51
- }, [activeViewport]);
52
- const handleBasemapTransparencyChange = React.useCallback((transparency) => {
53
- if (activeViewport) {
54
- activeViewport.displayStyle.changeBaseMapTransparency(transparency);
55
- activeViewport.invalidateRenderPlan();
56
- setBaseMapTransparencyValue(transparency);
57
- }
58
- }, [activeViewport]);
59
- const baseMapOptions = React.useMemo(() => {
60
- const baseOptions = [];
61
- baseOptions.push({ value: useColorLabel, label: useColorLabel });
62
- if (bases)
63
- baseOptions.push(...bases.map((value) => ({ value: value.name, label: value.name })));
64
- return baseOptions;
65
- }, [bases, useColorLabel]);
66
- const [presetColors] = React.useState([
67
- ColorDef.create(ColorByName.grey),
68
- ColorDef.create(ColorByName.lightGrey),
69
- ColorDef.create(ColorByName.darkGrey),
70
- ColorDef.create(ColorByName.lightBlue),
71
- ColorDef.create(ColorByName.lightGreen),
72
- ColorDef.create(ColorByName.darkGreen),
73
- ColorDef.create(ColorByName.tan),
74
- ColorDef.create(ColorByName.darkBrown),
75
- ]);
76
- const baseIsColor = React.useMemo(() => typeof selectedBaseMap === "number", [selectedBaseMap]);
77
- const baseIsMap = React.useMemo(() => !baseIsColor && (selectedBaseMap !== undefined), [baseIsColor, selectedBaseMap]);
78
- const bgColor = React.useMemo(() => baseIsColor ? selectedBaseMap : presetColors[0].toJSON(), [baseIsColor, selectedBaseMap, presetColors]);
79
- const [colorDialogTitle] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:ColorDialog.Title"));
80
- const selectedBaseMapValue = React.useMemo(() => {
81
- if (baseIsMap) {
82
- const mapName = selectedBaseMap.name;
83
- const foundItem = baseMapOptions.find((value) => value.label === mapName);
84
- if (foundItem)
85
- return foundItem;
86
- }
87
- return baseMapOptions[0];
88
- }, [selectedBaseMap, baseMapOptions, baseIsMap]);
89
- const handleBackgroundColorDialogOk = React.useCallback((bgColorDef) => {
90
- UiFramework.dialogs.modal.close();
91
- if (activeViewport) {
92
- // change color and make sure previously set transparency is not lost.
93
- const curTransparency = activeViewport.displayStyle.backgroundMapBase instanceof ColorDef ? activeViewport.displayStyle.backgroundMapBase.getTransparency() : 0;
94
- activeViewport.displayStyle.backgroundMapBase = bgColorDef.withTransparency(curTransparency);
95
- activeViewport.invalidateRenderPlan();
96
- setSelectedBaseMap(bgColorDef.toJSON());
97
- }
98
- }, [activeViewport]);
99
- const handleBackgroundColorDialogCancel = React.useCallback(() => {
100
- UiFramework.dialogs.modal.close();
101
- }, []);
102
- const handleBgColorClick = React.useCallback((newColor, e) => {
103
- e.preventDefault();
104
- UiFramework.dialogs.modal.open(React.createElement(ColorPickerDialog, { dialogTitle: colorDialogTitle, color: newColor, colorPresets: presetColors, colorInputType: "rgb", onOkResult: handleBackgroundColorDialogOk, onCancelResult: handleBackgroundColorDialogCancel }));
105
- }, [presetColors, handleBackgroundColorDialogOk]); // eslint-disable-line react-hooks/exhaustive-deps
106
- const handleBaseMapSelection = React.useCallback((value) => {
107
- if (bases && activeViewport && value) {
108
- const baseMap = bases.find((map) => map.name === value);
109
- if (baseMap) {
110
- const baseProps = baseMap.toJSON();
111
- if (activeViewport.displayStyle.backgroundMapBase instanceof BaseMapLayerSettings) {
112
- activeViewport.displayStyle.backgroundMapBase = activeViewport.displayStyle.backgroundMapBase.clone(baseProps);
113
- }
114
- else {
115
- activeViewport.displayStyle.backgroundMapBase = BaseMapLayerSettings.fromJSON(baseProps);
116
- }
117
- activeViewport.invalidateRenderPlan();
118
- setSelectedBaseMap(baseProps);
119
- }
120
- else {
121
- const bgColorDef = ColorDef.fromJSON(bgColor);
122
- const curTransparency = activeViewport.displayStyle.backgroundMapBase instanceof ColorDef ? activeViewport.displayStyle.backgroundMapBase.getTransparency() : 0;
123
- activeViewport.displayStyle.backgroundMapBase = bgColorDef.withTransparency(curTransparency);
124
- activeViewport.invalidateRenderPlan();
125
- setSelectedBaseMap(bgColorDef.toJSON());
126
- }
127
- }
128
- }, [bases, activeViewport, bgColor]);
129
- const handleVisibilityChange = React.useCallback(() => {
130
- if (activeViewport) {
131
- const newState = !baseMapVisible;
132
- // BaseMap visibility is only support when backgroundBase is an instance of BaseMapLayerSettings (i.e not a color)...
133
- if (activeViewport.displayStyle.backgroundMapBase instanceof BaseMapLayerSettings) {
134
- activeViewport.displayStyle.backgroundMapBase = activeViewport.displayStyle.backgroundMapBase.clone({ visible: newState });
135
- activeViewport.invalidateRenderPlan();
136
- }
137
- setBaseMapVisible(newState);
138
- }
139
- }, [baseMapVisible, activeViewport]);
140
- const [baseLayerLabel] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:Basemap.BaseLayer"));
141
- const [selectBaseMapLabel] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:Basemap.SelectBaseMap"));
142
- const [toggleVisibility] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:Widget.ToggleVisibility"));
143
- return (React.createElement(React.Fragment, null,
144
- React.createElement("div", { className: "map-manager-base-item" },
145
- React.createElement(Button, { size: "small", styleType: "borderless", title: toggleVisibility, onClick: handleVisibilityChange, disabled: props.disabled || !activeViewport || !(activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings) },
146
- React.createElement(WebFontIcon, { iconName: baseMapVisible ? "icon-visibility" : "icon-visibility-hide-2" })),
147
- React.createElement("span", { className: "map-manager-base-label" }, baseLayerLabel),
148
- React.createElement(Select, { className: "map-manager-base-item-select", options: baseMapOptions, placeholder: selectBaseMapLabel, value: selectedBaseMapValue.value, onChange: handleBaseMapSelection, size: "small", disabled: props.disabled }),
149
- baseIsColor &&
150
- React.createElement(ColorSwatch, { className: "map-manager-base-item-color", colorDef: ColorDef.fromJSON(bgColor), round: false, onColorPick: handleBgColorClick }),
151
- React.createElement(TransparencyPopupButton, { disabled: props.disabled, transparency: baseMapTransparencyValue, onTransparencyChange: handleBasemapTransparencyChange }))));
152
- }
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
+ /* eslint-disable deprecation/deprecation */
6
+ // cSpell:ignore droppable Sublayer Basemap
7
+ import { UiFramework } from "@itwin/appui-react";
8
+ import { BaseMapLayerSettings, ColorByName, ColorDef, ImageMapLayerSettings } from "@itwin/core-common";
9
+ import { WebFontIcon } from "@itwin/core-react";
10
+ import { ColorPickerDialog, ColorSwatch } from "@itwin/imodel-components-react";
11
+ import { Button, Select } from "@itwin/itwinui-react";
12
+ import * as React from "react";
13
+ import { MapLayersUI } from "../../mapLayers";
14
+ import "./BasemapPanel.scss";
15
+ import { useSourceMapContext } from "./MapLayerManager";
16
+ import { TransparencyPopupButton } from "./TransparencyPopupButton";
17
+ function getBaseMapFromStyle(displayStyle) {
18
+ if (!displayStyle)
19
+ return undefined;
20
+ if (displayStyle.settings.mapImagery.backgroundBase instanceof ImageMapLayerSettings || displayStyle.settings.mapImagery.backgroundBase instanceof ColorDef)
21
+ return displayStyle.settings.mapImagery.backgroundBase.toJSON();
22
+ return undefined;
23
+ }
24
+ /** @internal */
25
+ // eslint-disable-next-line @typescript-eslint/naming-convention
26
+ export function BasemapPanel(props) {
27
+ const [useColorLabel] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:Basemap.ColorFill"));
28
+ const { activeViewport, bases } = useSourceMapContext();
29
+ const [selectedBaseMap, setSelectedBaseMap] = React.useState(getBaseMapFromStyle(activeViewport?.displayStyle));
30
+ const [baseMapTransparencyValue, setBaseMapTransparencyValue] = React.useState(() => {
31
+ if (activeViewport)
32
+ return activeViewport.displayStyle.baseMapTransparency;
33
+ return 0;
34
+ });
35
+ const [baseMapVisible, setBaseMapVisible] = React.useState(() => {
36
+ if (activeViewport && activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings) {
37
+ return activeViewport.displayStyle.backgroundMapBase.visible;
38
+ }
39
+ return false;
40
+ });
41
+ // Monitor viewport updates, and refresh the widget accordingly.
42
+ // Note: This is needed for multiple viewport applications.
43
+ React.useEffect(() => {
44
+ if (activeViewport) {
45
+ setBaseMapTransparencyValue(activeViewport.displayStyle.baseMapTransparency);
46
+ setSelectedBaseMap(getBaseMapFromStyle(activeViewport.displayStyle));
47
+ if (activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings) {
48
+ setBaseMapVisible(activeViewport.displayStyle.backgroundMapBase.visible);
49
+ }
50
+ }
51
+ }, [activeViewport]);
52
+ const handleBasemapTransparencyChange = React.useCallback((transparency) => {
53
+ if (activeViewport) {
54
+ activeViewport.displayStyle.changeBaseMapTransparency(transparency);
55
+ activeViewport.invalidateRenderPlan();
56
+ setBaseMapTransparencyValue(transparency);
57
+ }
58
+ }, [activeViewport]);
59
+ const baseMapOptions = React.useMemo(() => {
60
+ const baseOptions = [];
61
+ baseOptions.push({ value: useColorLabel, label: useColorLabel });
62
+ if (bases)
63
+ baseOptions.push(...bases.map((value) => ({ value: value.name, label: value.name })));
64
+ return baseOptions;
65
+ }, [bases, useColorLabel]);
66
+ const [presetColors] = React.useState([
67
+ ColorDef.create(ColorByName.grey),
68
+ ColorDef.create(ColorByName.lightGrey),
69
+ ColorDef.create(ColorByName.darkGrey),
70
+ ColorDef.create(ColorByName.lightBlue),
71
+ ColorDef.create(ColorByName.lightGreen),
72
+ ColorDef.create(ColorByName.darkGreen),
73
+ ColorDef.create(ColorByName.tan),
74
+ ColorDef.create(ColorByName.darkBrown),
75
+ ]);
76
+ const baseIsColor = React.useMemo(() => typeof selectedBaseMap === "number", [selectedBaseMap]);
77
+ const baseIsMap = React.useMemo(() => !baseIsColor && (selectedBaseMap !== undefined), [baseIsColor, selectedBaseMap]);
78
+ const bgColor = React.useMemo(() => baseIsColor ? selectedBaseMap : presetColors[0].toJSON(), [baseIsColor, selectedBaseMap, presetColors]);
79
+ const [colorDialogTitle] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:ColorDialog.Title"));
80
+ const selectedBaseMapValue = React.useMemo(() => {
81
+ if (baseIsMap) {
82
+ const mapName = selectedBaseMap.name;
83
+ const foundItem = baseMapOptions.find((value) => value.label === mapName);
84
+ if (foundItem)
85
+ return foundItem;
86
+ }
87
+ return baseMapOptions[0];
88
+ }, [selectedBaseMap, baseMapOptions, baseIsMap]);
89
+ const handleBackgroundColorDialogOk = React.useCallback((bgColorDef) => {
90
+ UiFramework.dialogs.modal.close();
91
+ if (activeViewport) {
92
+ // change color and make sure previously set transparency is not lost.
93
+ const curTransparency = activeViewport.displayStyle.backgroundMapBase instanceof ColorDef ? activeViewport.displayStyle.backgroundMapBase.getTransparency() : 0;
94
+ activeViewport.displayStyle.backgroundMapBase = bgColorDef.withTransparency(curTransparency);
95
+ activeViewport.invalidateRenderPlan();
96
+ setSelectedBaseMap(bgColorDef.toJSON());
97
+ }
98
+ }, [activeViewport]);
99
+ const handleBackgroundColorDialogCancel = React.useCallback(() => {
100
+ UiFramework.dialogs.modal.close();
101
+ }, []);
102
+ const handleBgColorClick = React.useCallback((newColor, e) => {
103
+ e.preventDefault();
104
+ UiFramework.dialogs.modal.open(React.createElement(ColorPickerDialog, { dialogTitle: colorDialogTitle, color: newColor, colorPresets: presetColors, colorInputType: "rgb", onOkResult: handleBackgroundColorDialogOk, onCancelResult: handleBackgroundColorDialogCancel }));
105
+ }, [presetColors, handleBackgroundColorDialogOk]); // eslint-disable-line react-hooks/exhaustive-deps
106
+ const handleBaseMapSelection = React.useCallback((value) => {
107
+ if (bases && activeViewport && value) {
108
+ const baseMap = bases.find((map) => map.name === value);
109
+ if (baseMap) {
110
+ const baseProps = baseMap.toJSON();
111
+ if (activeViewport.displayStyle.backgroundMapBase instanceof BaseMapLayerSettings) {
112
+ activeViewport.displayStyle.backgroundMapBase = activeViewport.displayStyle.backgroundMapBase.clone(baseProps);
113
+ }
114
+ else {
115
+ activeViewport.displayStyle.backgroundMapBase = BaseMapLayerSettings.fromJSON(baseProps);
116
+ }
117
+ activeViewport.invalidateRenderPlan();
118
+ setSelectedBaseMap(baseProps);
119
+ }
120
+ else {
121
+ const bgColorDef = ColorDef.fromJSON(bgColor);
122
+ const curTransparency = activeViewport.displayStyle.backgroundMapBase instanceof ColorDef ? activeViewport.displayStyle.backgroundMapBase.getTransparency() : 0;
123
+ activeViewport.displayStyle.backgroundMapBase = bgColorDef.withTransparency(curTransparency);
124
+ activeViewport.invalidateRenderPlan();
125
+ setSelectedBaseMap(bgColorDef.toJSON());
126
+ }
127
+ }
128
+ }, [bases, activeViewport, bgColor]);
129
+ const handleVisibilityChange = React.useCallback(() => {
130
+ if (activeViewport) {
131
+ const newState = !baseMapVisible;
132
+ // BaseMap visibility is only support when backgroundBase is an instance of BaseMapLayerSettings (i.e not a color)...
133
+ if (activeViewport.displayStyle.backgroundMapBase instanceof BaseMapLayerSettings) {
134
+ activeViewport.displayStyle.backgroundMapBase = activeViewport.displayStyle.backgroundMapBase.clone({ visible: newState });
135
+ activeViewport.invalidateRenderPlan();
136
+ }
137
+ setBaseMapVisible(newState);
138
+ }
139
+ }, [baseMapVisible, activeViewport]);
140
+ const [baseLayerLabel] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:Basemap.BaseLayer"));
141
+ const [selectBaseMapLabel] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:Basemap.SelectBaseMap"));
142
+ const [toggleVisibility] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:Widget.ToggleVisibility"));
143
+ return (React.createElement(React.Fragment, null,
144
+ React.createElement("div", { className: "map-manager-base-item" },
145
+ React.createElement(Button, { size: "small", styleType: "borderless", title: toggleVisibility, onClick: handleVisibilityChange, disabled: props.disabled || !activeViewport || !(activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings) },
146
+ React.createElement(WebFontIcon, { iconName: baseMapVisible ? "icon-visibility" : "icon-visibility-hide-2" })),
147
+ React.createElement("span", { className: "map-manager-base-label" }, baseLayerLabel),
148
+ React.createElement(Select, { className: "map-manager-base-item-select", options: baseMapOptions, placeholder: selectBaseMapLabel, value: selectedBaseMapValue.value, onChange: handleBaseMapSelection, size: "small", disabled: props.disabled }),
149
+ baseIsColor &&
150
+ React.createElement(ColorSwatch, { className: "map-manager-base-item-color", colorDef: ColorDef.fromJSON(bgColor), round: false, onColorPick: handleBgColorClick }),
151
+ React.createElement(TransparencyPopupButton, { disabled: props.disabled, transparency: baseMapTransparencyValue, onTransparencyChange: handleBasemapTransparencyChange }))));
152
+ }
153
153
  //# sourceMappingURL=BasemapPanel.js.map
@@ -1 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BAAsB,EAAE,IAAI,EAAC,OAAO,EAC9C,QAAQ,EAAE,KAAK,CAAC,QAAQ,GACxB;YAEA,WAAW;gBACX,oBAAC,WAAW,IAAC,SAAS,EAAC,6BAA6B,EAAC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,kBAAkB,GAAI;YAE9I,oBAAC,uBAAuB,IAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,YAAY,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,+BAA+B,GAAG,CAC/I,CACL,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/* eslint-disable deprecation/deprecation */\r\n// cSpell:ignore droppable Sublayer Basemap\r\n\r\nimport { UiFramework } from \"@itwin/appui-react\";\r\nimport { BaseMapLayerSettings, ColorByName, ColorDef, ImageMapLayerSettings, MapLayerProps } from \"@itwin/core-common\";\r\nimport { DisplayStyleState } from \"@itwin/core-frontend\";\r\nimport { WebFontIcon } from \"@itwin/core-react\";\r\nimport { ColorPickerDialog, ColorSwatch } from \"@itwin/imodel-components-react\";\r\nimport { Button, Select, SelectOption } from \"@itwin/itwinui-react\";\r\nimport * as React from \"react\";\r\nimport { MapLayersUI } from \"../../mapLayers\";\r\nimport \"./BasemapPanel.scss\";\r\nimport { useSourceMapContext } from \"./MapLayerManager\";\r\nimport { TransparencyPopupButton } from \"./TransparencyPopupButton\";\r\n\r\nfunction getBaseMapFromStyle(displayStyle: DisplayStyleState | undefined) {\r\n if (!displayStyle)\r\n return undefined;\r\n\r\n if (displayStyle.settings.mapImagery.backgroundBase instanceof ImageMapLayerSettings || displayStyle.settings.mapImagery.backgroundBase instanceof ColorDef)\r\n return displayStyle.settings.mapImagery.backgroundBase.toJSON();\r\n\r\n return undefined;\r\n}\r\n\r\ninterface BasemapPanelProps {\r\n disabled?: boolean;\r\n}\r\n\r\n/** @internal */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function BasemapPanel(props: BasemapPanelProps) {\r\n const [useColorLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.ColorFill\"));\r\n const { activeViewport, bases } = useSourceMapContext();\r\n const [selectedBaseMap, setSelectedBaseMap] = React.useState<MapLayerProps | number | undefined>(getBaseMapFromStyle(activeViewport?.displayStyle));\r\n const [baseMapTransparencyValue, setBaseMapTransparencyValue] = React.useState(() => {\r\n if (activeViewport)\r\n return activeViewport.displayStyle.baseMapTransparency;\r\n return 0;\r\n });\r\n const [baseMapVisible, setBaseMapVisible] = React.useState(() => {\r\n if (activeViewport && activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings) {\r\n return activeViewport.displayStyle.backgroundMapBase.visible;\r\n }\r\n return false;\r\n });\r\n\r\n // Monitor viewport updates, and refresh the widget accordingly.\r\n // Note: This is needed for multiple viewport applications.\r\n React.useEffect(() => {\r\n if (activeViewport) {\r\n setBaseMapTransparencyValue(activeViewport.displayStyle.baseMapTransparency);\r\n setSelectedBaseMap(getBaseMapFromStyle(activeViewport.displayStyle));\r\n if (activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings) {\r\n setBaseMapVisible(activeViewport.displayStyle.backgroundMapBase.visible);\r\n }\r\n }\r\n }, [activeViewport]);\r\n\r\n const handleBasemapTransparencyChange = React.useCallback((transparency: number) => {\r\n if (activeViewport) {\r\n activeViewport.displayStyle.changeBaseMapTransparency(transparency);\r\n activeViewport.invalidateRenderPlan();\r\n setBaseMapTransparencyValue(transparency);\r\n }\r\n }, [activeViewport]);\r\n\r\n const baseMapOptions = React.useMemo<SelectOption<string>[]>(() => {\r\n const baseOptions: SelectOption<string>[] = [];\r\n\r\n baseOptions.push({ value: useColorLabel, label: useColorLabel });\r\n\r\n if (bases)\r\n baseOptions.push(...bases.map((value) => ({ value: value.name, label: value.name })));\r\n return baseOptions;\r\n }, [bases, useColorLabel]);\r\n\r\n const [presetColors] = React.useState([\r\n ColorDef.create(ColorByName.grey),\r\n ColorDef.create(ColorByName.lightGrey),\r\n ColorDef.create(ColorByName.darkGrey),\r\n ColorDef.create(ColorByName.lightBlue),\r\n ColorDef.create(ColorByName.lightGreen),\r\n ColorDef.create(ColorByName.darkGreen),\r\n ColorDef.create(ColorByName.tan),\r\n ColorDef.create(ColorByName.darkBrown),\r\n ]);\r\n\r\n const baseIsColor = React.useMemo(() => typeof selectedBaseMap === \"number\", [selectedBaseMap]);\r\n const baseIsMap = React.useMemo(() => !baseIsColor && (selectedBaseMap !== undefined), [baseIsColor, selectedBaseMap]);\r\n const bgColor = React.useMemo(() => baseIsColor ? selectedBaseMap as number : presetColors[0].toJSON(), [baseIsColor, selectedBaseMap, presetColors]);\r\n const [colorDialogTitle] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:ColorDialog.Title\"));\r\n const selectedBaseMapValue = React.useMemo(() => {\r\n if (baseIsMap) {\r\n const mapName = (selectedBaseMap! as MapLayerProps).name;\r\n const foundItem = baseMapOptions.find((value) => value.label === mapName);\r\n if (foundItem)\r\n return foundItem;\r\n }\r\n return baseMapOptions[0];\r\n }, [selectedBaseMap, baseMapOptions, baseIsMap]);\r\n\r\n const handleBackgroundColorDialogOk = React.useCallback((bgColorDef: ColorDef) => {\r\n UiFramework.dialogs.modal.close();\r\n if (activeViewport) {\r\n // change color and make sure previously set transparency is not lost.\r\n const curTransparency = activeViewport.displayStyle.backgroundMapBase instanceof ColorDef ? activeViewport.displayStyle.backgroundMapBase.getTransparency() : 0;\r\n activeViewport.displayStyle.backgroundMapBase = bgColorDef.withTransparency(curTransparency);\r\n activeViewport.invalidateRenderPlan();\r\n setSelectedBaseMap(bgColorDef.toJSON());\r\n }\r\n }, [activeViewport]);\r\n\r\n const handleBackgroundColorDialogCancel = React.useCallback(() => {\r\n UiFramework.dialogs.modal.close();\r\n }, []);\r\n\r\n const handleBgColorClick = React.useCallback((newColor: ColorDef, e: React.MouseEvent<Element, MouseEvent>) => {\r\n e.preventDefault();\r\n UiFramework.dialogs.modal.open(<ColorPickerDialog dialogTitle={colorDialogTitle} color={newColor} colorPresets={presetColors} colorInputType={\"rgb\"}\r\n onOkResult={handleBackgroundColorDialogOk} onCancelResult={handleBackgroundColorDialogCancel} />);\r\n }, [presetColors, handleBackgroundColorDialogOk]); // eslint-disable-line react-hooks/exhaustive-deps\r\n\r\n const handleBaseMapSelection = React.useCallback((value: string) => {\r\n if (bases && activeViewport && value) {\r\n const baseMap = bases.find((map) => map.name === value);\r\n if (baseMap) {\r\n const baseProps: MapLayerProps = baseMap.toJSON();\r\n if (activeViewport.displayStyle.backgroundMapBase instanceof BaseMapLayerSettings) {\r\n activeViewport.displayStyle.backgroundMapBase = activeViewport.displayStyle.backgroundMapBase.clone(baseProps);\r\n } else {\r\n activeViewport.displayStyle.backgroundMapBase = BaseMapLayerSettings.fromJSON(baseProps);\r\n }\r\n activeViewport.invalidateRenderPlan();\r\n setSelectedBaseMap(baseProps);\r\n } else {\r\n const bgColorDef = ColorDef.fromJSON(bgColor);\r\n const curTransparency = activeViewport.displayStyle.backgroundMapBase instanceof ColorDef ? activeViewport.displayStyle.backgroundMapBase.getTransparency() : 0;\r\n activeViewport.displayStyle.backgroundMapBase = bgColorDef.withTransparency(curTransparency);\r\n activeViewport.invalidateRenderPlan();\r\n setSelectedBaseMap(bgColorDef.toJSON());\r\n }\r\n }\r\n }, [bases, activeViewport, bgColor]);\r\n\r\n const handleVisibilityChange = React.useCallback(() => {\r\n if (activeViewport) {\r\n const newState = !baseMapVisible;\r\n // BaseMap visibility is only support when backgroundBase is an instance of BaseMapLayerSettings (i.e not a color)...\r\n if (activeViewport.displayStyle.backgroundMapBase instanceof BaseMapLayerSettings) {\r\n activeViewport.displayStyle.backgroundMapBase = activeViewport.displayStyle.backgroundMapBase.clone({ visible: newState });\r\n activeViewport.invalidateRenderPlan();\r\n }\r\n setBaseMapVisible(newState);\r\n }\r\n }, [baseMapVisible, activeViewport]);\r\n\r\n const [baseLayerLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.BaseLayer\"));\r\n const [selectBaseMapLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.SelectBaseMap\"));\r\n const [toggleVisibility] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.ToggleVisibility\"));\r\n\r\n return (\r\n <>\r\n <div className=\"map-manager-base-item\" >\r\n <Button size=\"small\" styleType=\"borderless\" title={toggleVisibility} onClick={handleVisibilityChange} disabled={props.disabled || !activeViewport || !(activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings)}>\r\n <WebFontIcon iconName={baseMapVisible ? \"icon-visibility\" : \"icon-visibility-hide-2\"} />\r\n </Button>\r\n <span className=\"map-manager-base-label\">{baseLayerLabel}</span>\r\n <Select className=\"map-manager-base-item-select\"\r\n options={baseMapOptions}\r\n placeholder={selectBaseMapLabel}\r\n value={selectedBaseMapValue.value}\r\n onChange={handleBaseMapSelection} size=\"small\"\r\n disabled={props.disabled}\r\n />\r\n {\r\n baseIsColor &&\r\n <ColorSwatch className=\"map-manager-base-item-color\" colorDef={ColorDef.fromJSON(bgColor)} round={false} onColorPick={handleBgColorClick} />\r\n }\r\n <TransparencyPopupButton disabled={props.disabled} transparency={baseMapTransparencyValue} onTransparencyChange={handleBasemapTransparencyChange}/>\r\n </div>\r\n </>\r\n );\r\n}\r\n"]}
1
+ {"version":3,"file":"BasemapPanel.js","sourceRoot":"","sources":["../../../../src/ui/widget/BasemapPanel.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,4CAA4C;AAC5C,2CAA2C;AAE3C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,QAAQ,EAAE,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E9I,oBAAC,uBAAuB,IAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,YAAY,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,+BAA+B,GAAG,CAC/I,CACL,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/* eslint-disable deprecation/deprecation */\n// cSpell:ignore droppable Sublayer Basemap\n\nimport { UiFramework } from \"@itwin/appui-react\";\nimport { BaseMapLayerSettings, ColorByName, ColorDef, ImageMapLayerSettings, MapLayerProps } from \"@itwin/core-common\";\nimport { DisplayStyleState } from \"@itwin/core-frontend\";\nimport { WebFontIcon } from \"@itwin/core-react\";\nimport { ColorPickerDialog, ColorSwatch } from \"@itwin/imodel-components-react\";\nimport { Button, Select, SelectOption } from \"@itwin/itwinui-react\";\nimport * as React from \"react\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport \"./BasemapPanel.scss\";\nimport { useSourceMapContext } from \"./MapLayerManager\";\nimport { TransparencyPopupButton } from \"./TransparencyPopupButton\";\n\nfunction getBaseMapFromStyle(displayStyle: DisplayStyleState | undefined) {\n if (!displayStyle)\n return undefined;\n\n if (displayStyle.settings.mapImagery.backgroundBase instanceof ImageMapLayerSettings || displayStyle.settings.mapImagery.backgroundBase instanceof ColorDef)\n return displayStyle.settings.mapImagery.backgroundBase.toJSON();\n\n return undefined;\n}\n\ninterface BasemapPanelProps {\n disabled?: boolean;\n}\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function BasemapPanel(props: BasemapPanelProps) {\n const [useColorLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.ColorFill\"));\n const { activeViewport, bases } = useSourceMapContext();\n const [selectedBaseMap, setSelectedBaseMap] = React.useState<MapLayerProps | number | undefined>(getBaseMapFromStyle(activeViewport?.displayStyle));\n const [baseMapTransparencyValue, setBaseMapTransparencyValue] = React.useState(() => {\n if (activeViewport)\n return activeViewport.displayStyle.baseMapTransparency;\n return 0;\n });\n const [baseMapVisible, setBaseMapVisible] = React.useState(() => {\n if (activeViewport && activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings) {\n return activeViewport.displayStyle.backgroundMapBase.visible;\n }\n return false;\n });\n\n // Monitor viewport updates, and refresh the widget accordingly.\n // Note: This is needed for multiple viewport applications.\n React.useEffect(() => {\n if (activeViewport) {\n setBaseMapTransparencyValue(activeViewport.displayStyle.baseMapTransparency);\n setSelectedBaseMap(getBaseMapFromStyle(activeViewport.displayStyle));\n if (activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings) {\n setBaseMapVisible(activeViewport.displayStyle.backgroundMapBase.visible);\n }\n }\n }, [activeViewport]);\n\n const handleBasemapTransparencyChange = React.useCallback((transparency: number) => {\n if (activeViewport) {\n activeViewport.displayStyle.changeBaseMapTransparency(transparency);\n activeViewport.invalidateRenderPlan();\n setBaseMapTransparencyValue(transparency);\n }\n }, [activeViewport]);\n\n const baseMapOptions = React.useMemo<SelectOption<string>[]>(() => {\n const baseOptions: SelectOption<string>[] = [];\n\n baseOptions.push({ value: useColorLabel, label: useColorLabel });\n\n if (bases)\n baseOptions.push(...bases.map((value) => ({ value: value.name, label: value.name })));\n return baseOptions;\n }, [bases, useColorLabel]);\n\n const [presetColors] = React.useState([\n ColorDef.create(ColorByName.grey),\n ColorDef.create(ColorByName.lightGrey),\n ColorDef.create(ColorByName.darkGrey),\n ColorDef.create(ColorByName.lightBlue),\n ColorDef.create(ColorByName.lightGreen),\n ColorDef.create(ColorByName.darkGreen),\n ColorDef.create(ColorByName.tan),\n ColorDef.create(ColorByName.darkBrown),\n ]);\n\n const baseIsColor = React.useMemo(() => typeof selectedBaseMap === \"number\", [selectedBaseMap]);\n const baseIsMap = React.useMemo(() => !baseIsColor && (selectedBaseMap !== undefined), [baseIsColor, selectedBaseMap]);\n const bgColor = React.useMemo(() => baseIsColor ? selectedBaseMap as number : presetColors[0].toJSON(), [baseIsColor, selectedBaseMap, presetColors]);\n const [colorDialogTitle] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:ColorDialog.Title\"));\n const selectedBaseMapValue = React.useMemo(() => {\n if (baseIsMap) {\n const mapName = (selectedBaseMap! as MapLayerProps).name;\n const foundItem = baseMapOptions.find((value) => value.label === mapName);\n if (foundItem)\n return foundItem;\n }\n return baseMapOptions[0];\n }, [selectedBaseMap, baseMapOptions, baseIsMap]);\n\n const handleBackgroundColorDialogOk = React.useCallback((bgColorDef: ColorDef) => {\n UiFramework.dialogs.modal.close();\n if (activeViewport) {\n // change color and make sure previously set transparency is not lost.\n const curTransparency = activeViewport.displayStyle.backgroundMapBase instanceof ColorDef ? activeViewport.displayStyle.backgroundMapBase.getTransparency() : 0;\n activeViewport.displayStyle.backgroundMapBase = bgColorDef.withTransparency(curTransparency);\n activeViewport.invalidateRenderPlan();\n setSelectedBaseMap(bgColorDef.toJSON());\n }\n }, [activeViewport]);\n\n const handleBackgroundColorDialogCancel = React.useCallback(() => {\n UiFramework.dialogs.modal.close();\n }, []);\n\n const handleBgColorClick = React.useCallback((newColor: ColorDef, e: React.MouseEvent<Element, MouseEvent>) => {\n e.preventDefault();\n UiFramework.dialogs.modal.open(<ColorPickerDialog dialogTitle={colorDialogTitle} color={newColor} colorPresets={presetColors} colorInputType={\"rgb\"}\n onOkResult={handleBackgroundColorDialogOk} onCancelResult={handleBackgroundColorDialogCancel} />);\n }, [presetColors, handleBackgroundColorDialogOk]); // eslint-disable-line react-hooks/exhaustive-deps\n\n const handleBaseMapSelection = React.useCallback((value: string) => {\n if (bases && activeViewport && value) {\n const baseMap = bases.find((map) => map.name === value);\n if (baseMap) {\n const baseProps: MapLayerProps = baseMap.toJSON();\n if (activeViewport.displayStyle.backgroundMapBase instanceof BaseMapLayerSettings) {\n activeViewport.displayStyle.backgroundMapBase = activeViewport.displayStyle.backgroundMapBase.clone(baseProps);\n } else {\n activeViewport.displayStyle.backgroundMapBase = BaseMapLayerSettings.fromJSON(baseProps);\n }\n activeViewport.invalidateRenderPlan();\n setSelectedBaseMap(baseProps);\n } else {\n const bgColorDef = ColorDef.fromJSON(bgColor);\n const curTransparency = activeViewport.displayStyle.backgroundMapBase instanceof ColorDef ? activeViewport.displayStyle.backgroundMapBase.getTransparency() : 0;\n activeViewport.displayStyle.backgroundMapBase = bgColorDef.withTransparency(curTransparency);\n activeViewport.invalidateRenderPlan();\n setSelectedBaseMap(bgColorDef.toJSON());\n }\n }\n }, [bases, activeViewport, bgColor]);\n\n const handleVisibilityChange = React.useCallback(() => {\n if (activeViewport) {\n const newState = !baseMapVisible;\n // BaseMap visibility is only support when backgroundBase is an instance of BaseMapLayerSettings (i.e not a color)...\n if (activeViewport.displayStyle.backgroundMapBase instanceof BaseMapLayerSettings) {\n activeViewport.displayStyle.backgroundMapBase = activeViewport.displayStyle.backgroundMapBase.clone({ visible: newState });\n activeViewport.invalidateRenderPlan();\n }\n setBaseMapVisible(newState);\n }\n }, [baseMapVisible, activeViewport]);\n\n const [baseLayerLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.BaseLayer\"));\n const [selectBaseMapLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.SelectBaseMap\"));\n const [toggleVisibility] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.ToggleVisibility\"));\n\n return (\n <>\n <div className=\"map-manager-base-item\" >\n <Button size=\"small\" styleType=\"borderless\" title={toggleVisibility} onClick={handleVisibilityChange} disabled={props.disabled || !activeViewport || !(activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings)}>\n <WebFontIcon iconName={baseMapVisible ? \"icon-visibility\" : \"icon-visibility-hide-2\"} />\n </Button>\n <span className=\"map-manager-base-label\">{baseLayerLabel}</span>\n <Select className=\"map-manager-base-item-select\"\n options={baseMapOptions}\n placeholder={selectBaseMapLabel}\n value={selectedBaseMapValue.value}\n onChange={handleBaseMapSelection} size=\"small\"\n disabled={props.disabled}\n />\n {\n baseIsColor &&\n <ColorSwatch className=\"map-manager-base-item-color\" colorDef={ColorDef.fromJSON(bgColor)} round={false} onColorPick={handleBgColorClick} />\n }\n <TransparencyPopupButton disabled={props.disabled} transparency={baseMapTransparencyValue} onTransparencyChange={handleBasemapTransparencyChange}/>\n </div>\n </>\n );\n}\n"]}
@@ -1,87 +1,87 @@
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
- @import "~@itwin/core-react/lib/cjs/core-react/index";
6
-
7
- $divider-color: $buic-background-toolbutton-stroke;
8
- $hovered-icon-color: $buic-foreground-primary;
9
-
10
- .map-manager-basemap {
11
- display: flex;
12
- flex-direction: column;
13
- width: 100%;
14
- align-items: flex-start;
15
- margin-bottom: 15px;
16
-
17
- * {
18
- box-sizing: border-box;
19
- }
20
-
21
- .map-manager-base-header {
22
- display: flex;
23
- align-items: center;
24
- width: 100%;
25
- margin-top: 5px;
26
-
27
- }
28
-
29
- .map-manager-base-label {
30
- margin-left: 2px;
31
- padding-right: 10px;
32
- }
33
-
34
- .map-manager-base-item {
35
- display: flex;
36
- flex-direction: row;
37
- align-items: center;
38
- width: 100%;
39
-
40
- & .iui-select {
41
- overflow: hidden;
42
- }
43
-
44
-
45
- .map-manager-base-item-select {
46
- width: 100%; // makes the Select control fill empty space on the right
47
- }
48
-
49
- button.map-manager-base-settings-button {
50
- border: none;
51
- margin-left: 4px;
52
- background-color: transparent;
53
- color: $buic-foreground-body;
54
-
55
- &:hover {
56
- background-color: transparent;
57
- color: $hovered-icon-color;
58
- }
59
- }
60
-
61
- .uicore-reactSelectTop {
62
- width: 100%;
63
- line-height: inherit;
64
- }
65
-
66
- .map-manager-base-item-select {
67
- height: 2.0em;
68
- width: 100%;
69
- min-width: 100px;
70
- margin-right: 6px;
71
- }
72
-
73
- .map-manager-base-item-transparency {
74
- max-width: 160px;
75
- width: 160px;
76
- display: flex;
77
- justify-content: center;
78
- margin-right: 6px;
79
- }
80
-
81
- .map-manager-base-item-color.components-color-swatch {
82
- margin-left: 6px;
83
- width: 2em;
84
- height: 2em;
85
- }
86
- }
87
- }
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
+ @import "~@itwin/core-react/lib/cjs/core-react/index";
6
+
7
+ $divider-color: $buic-background-toolbutton-stroke;
8
+ $hovered-icon-color: $buic-foreground-primary;
9
+
10
+ .map-manager-basemap {
11
+ display: flex;
12
+ flex-direction: column;
13
+ width: 100%;
14
+ align-items: flex-start;
15
+ margin-bottom: 15px;
16
+
17
+ * {
18
+ box-sizing: border-box;
19
+ }
20
+
21
+ .map-manager-base-header {
22
+ display: flex;
23
+ align-items: center;
24
+ width: 100%;
25
+ margin-top: 5px;
26
+
27
+ }
28
+
29
+ .map-manager-base-label {
30
+ margin-left: 2px;
31
+ padding-right: 10px;
32
+ }
33
+
34
+ .map-manager-base-item {
35
+ display: flex;
36
+ flex-direction: row;
37
+ align-items: center;
38
+ width: 100%;
39
+
40
+ & .iui-select {
41
+ overflow: hidden;
42
+ }
43
+
44
+
45
+ .map-manager-base-item-select {
46
+ width: 100%; // makes the Select control fill empty space on the right
47
+ }
48
+
49
+ button.map-manager-base-settings-button {
50
+ border: none;
51
+ margin-left: 4px;
52
+ background-color: transparent;
53
+ color: $buic-foreground-body;
54
+
55
+ &:hover {
56
+ background-color: transparent;
57
+ color: $hovered-icon-color;
58
+ }
59
+ }
60
+
61
+ .uicore-reactSelectTop {
62
+ width: 100%;
63
+ line-height: inherit;
64
+ }
65
+
66
+ .map-manager-base-item-select {
67
+ height: 2.0em;
68
+ width: 100%;
69
+ min-width: 100px;
70
+ margin-right: 6px;
71
+ }
72
+
73
+ .map-manager-base-item-transparency {
74
+ max-width: 160px;
75
+ width: 160px;
76
+ display: flex;
77
+ justify-content: center;
78
+ margin-right: 6px;
79
+ }
80
+
81
+ .map-manager-base-item-color.components-color-swatch {
82
+ margin-left: 6px;
83
+ width: 2em;
84
+ height: 2em;
85
+ }
86
+ }
87
+ }