@itwin/map-layers 4.0.0-dev.28 → 4.0.0-dev.32

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 (157) hide show
  1. package/lib/cjs/MapLayerPreferences.d.ts +88 -88
  2. package/lib/cjs/MapLayerPreferences.js +311 -311
  3. package/lib/cjs/MapLayerPreferences.js.map +1 -1
  4. package/lib/cjs/map-layers.d.ts +6 -6
  5. package/lib/cjs/map-layers.js +22 -22
  6. package/lib/cjs/mapLayers.d.ts +44 -44
  7. package/lib/cjs/mapLayers.js +61 -61
  8. package/lib/cjs/mapLayers.js.map +1 -1
  9. package/lib/cjs/ui/FeatureInfoUiItemsProvider.d.ts +11 -11
  10. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js +51 -51
  11. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  12. package/lib/cjs/ui/Interfaces.d.ts +50 -50
  13. package/lib/cjs/ui/Interfaces.js +2 -2
  14. package/lib/cjs/ui/Interfaces.js.map +1 -1
  15. package/lib/cjs/ui/MapFeatureInfoTool.d.ts +13 -13
  16. package/lib/cjs/ui/MapFeatureInfoTool.js +50 -50
  17. package/lib/cjs/ui/MapFeatureInfoTool.js.map +1 -1
  18. package/lib/cjs/ui/MapLayersUiItemsProvider.d.ts +8 -8
  19. package/lib/cjs/ui/MapLayersUiItemsProvider.js +38 -38
  20. package/lib/cjs/ui/MapLayersUiItemsProvider.js.map +1 -1
  21. package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts +14 -14
  22. package/lib/cjs/ui/widget/AttachLayerPopupButton.js +335 -335
  23. package/lib/cjs/ui/widget/BasemapPanel.d.ts +8 -8
  24. package/lib/cjs/ui/widget/BasemapPanel.js +156 -156
  25. package/lib/cjs/ui/widget/BasemapPanel.js.map +1 -1
  26. package/lib/cjs/ui/widget/BasemapPanel.scss +87 -87
  27. package/lib/cjs/ui/widget/ConfirmMessageDialog.d.ts +21 -21
  28. package/lib/cjs/ui/widget/ConfirmMessageDialog.js +22 -22
  29. package/lib/cjs/ui/widget/ConfirmMessageDialog.js.map +1 -1
  30. package/lib/cjs/ui/widget/FeatureInfoDataProvider.d.ts +40 -40
  31. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js +138 -138
  32. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  33. package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts +7 -7
  34. package/lib/cjs/ui/widget/FeatureInfoWidget.js +65 -65
  35. package/lib/cjs/ui/widget/FeatureInfoWidget.js.map +1 -1
  36. package/lib/cjs/ui/widget/MapLayerDroppable.d.ts +19 -19
  37. package/lib/cjs/ui/widget/MapLayerDroppable.js +85 -85
  38. package/lib/cjs/ui/widget/MapLayerDroppable.js.map +1 -1
  39. package/lib/cjs/ui/widget/MapLayerManager.d.ts +26 -26
  40. package/lib/cjs/ui/widget/MapLayerManager.js +401 -401
  41. package/lib/cjs/ui/widget/MapLayerManager.js.map +1 -1
  42. package/lib/cjs/ui/widget/MapLayerManager.scss +409 -409
  43. package/lib/cjs/ui/widget/MapLayerSettingsMenu.d.ts +12 -12
  44. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js +82 -82
  45. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  46. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.d.ts +7 -7
  47. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js +65 -65
  48. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  49. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.scss +20 -20
  50. package/lib/cjs/ui/widget/MapLayersWidget.d.ts +11 -11
  51. package/lib/cjs/ui/widget/MapLayersWidget.js +31 -31
  52. package/lib/cjs/ui/widget/MapLayersWidget.js.map +1 -1
  53. package/lib/cjs/ui/widget/MapManagerSettings.d.ts +3 -3
  54. package/lib/cjs/ui/widget/MapManagerSettings.js +200 -200
  55. package/lib/cjs/ui/widget/MapManagerSettings.js.map +1 -1
  56. package/lib/cjs/ui/widget/MapManagerSettings.scss +29 -29
  57. package/lib/cjs/ui/widget/MapUrlDialog.d.ts +23 -23
  58. package/lib/cjs/ui/widget/MapUrlDialog.d.ts.map +1 -1
  59. package/lib/cjs/ui/widget/MapUrlDialog.js +530 -524
  60. package/lib/cjs/ui/widget/MapUrlDialog.js.map +1 -1
  61. package/lib/cjs/ui/widget/MapUrlDialog.scss +100 -100
  62. package/lib/cjs/ui/widget/SelectMapFormat.d.ts +18 -18
  63. package/lib/cjs/ui/widget/SelectMapFormat.js +54 -54
  64. package/lib/cjs/ui/widget/SelectMapFormat.js.map +1 -1
  65. package/lib/cjs/ui/widget/SubLayersDataProvider.d.ts +20 -20
  66. package/lib/cjs/ui/widget/SubLayersDataProvider.js +75 -75
  67. package/lib/cjs/ui/widget/SubLayersDataProvider.js.map +1 -1
  68. package/lib/cjs/ui/widget/SubLayersPopupButton.d.ts +10 -10
  69. package/lib/cjs/ui/widget/SubLayersPopupButton.js +40 -40
  70. package/lib/cjs/ui/widget/SubLayersPopupButton.js.map +1 -1
  71. package/lib/cjs/ui/widget/SubLayersTree.d.ts +15 -15
  72. package/lib/cjs/ui/widget/SubLayersTree.js +413 -413
  73. package/lib/cjs/ui/widget/SubLayersTree.js.map +1 -1
  74. package/lib/cjs/ui/widget/SubLayersTree.scss +69 -69
  75. package/lib/cjs/ui/widget/TransparencyPopupButton.d.ts +14 -14
  76. package/lib/cjs/ui/widget/TransparencyPopupButton.js +47 -47
  77. package/lib/cjs/ui/widget/TransparencyPopupButton.js.map +1 -1
  78. package/lib/cjs/ui/widget/TransparencyPopupButton.scss +36 -36
  79. package/lib/esm/MapLayerPreferences.d.ts +88 -88
  80. package/lib/esm/MapLayerPreferences.js +307 -307
  81. package/lib/esm/MapLayerPreferences.js.map +1 -1
  82. package/lib/esm/map-layers.d.ts +6 -6
  83. package/lib/esm/map-layers.js +10 -10
  84. package/lib/esm/mapLayers.d.ts +44 -44
  85. package/lib/esm/mapLayers.js +57 -57
  86. package/lib/esm/mapLayers.js.map +1 -1
  87. package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts +11 -11
  88. package/lib/esm/ui/FeatureInfoUiItemsProvider.js +47 -47
  89. package/lib/esm/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  90. package/lib/esm/ui/Interfaces.d.ts +50 -50
  91. package/lib/esm/ui/Interfaces.js +1 -1
  92. package/lib/esm/ui/Interfaces.js.map +1 -1
  93. package/lib/esm/ui/MapFeatureInfoTool.d.ts +13 -13
  94. package/lib/esm/ui/MapFeatureInfoTool.js +45 -45
  95. package/lib/esm/ui/MapFeatureInfoTool.js.map +1 -1
  96. package/lib/esm/ui/MapLayersUiItemsProvider.d.ts +8 -8
  97. package/lib/esm/ui/MapLayersUiItemsProvider.js +34 -34
  98. package/lib/esm/ui/MapLayersUiItemsProvider.js.map +1 -1
  99. package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts +14 -14
  100. package/lib/esm/ui/widget/AttachLayerPopupButton.js +331 -331
  101. package/lib/esm/ui/widget/BasemapPanel.d.ts +8 -8
  102. package/lib/esm/ui/widget/BasemapPanel.js +152 -152
  103. package/lib/esm/ui/widget/BasemapPanel.js.map +1 -1
  104. package/lib/esm/ui/widget/BasemapPanel.scss +87 -87
  105. package/lib/esm/ui/widget/ConfirmMessageDialog.d.ts +21 -21
  106. package/lib/esm/ui/widget/ConfirmMessageDialog.js +18 -18
  107. package/lib/esm/ui/widget/ConfirmMessageDialog.js.map +1 -1
  108. package/lib/esm/ui/widget/FeatureInfoDataProvider.d.ts +40 -40
  109. package/lib/esm/ui/widget/FeatureInfoDataProvider.js +134 -134
  110. package/lib/esm/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  111. package/lib/esm/ui/widget/FeatureInfoWidget.d.ts +7 -7
  112. package/lib/esm/ui/widget/FeatureInfoWidget.js +61 -61
  113. package/lib/esm/ui/widget/FeatureInfoWidget.js.map +1 -1
  114. package/lib/esm/ui/widget/MapLayerDroppable.d.ts +19 -19
  115. package/lib/esm/ui/widget/MapLayerDroppable.js +81 -81
  116. package/lib/esm/ui/widget/MapLayerDroppable.js.map +1 -1
  117. package/lib/esm/ui/widget/MapLayerManager.d.ts +26 -26
  118. package/lib/esm/ui/widget/MapLayerManager.js +396 -396
  119. package/lib/esm/ui/widget/MapLayerManager.js.map +1 -1
  120. package/lib/esm/ui/widget/MapLayerManager.scss +409 -409
  121. package/lib/esm/ui/widget/MapLayerSettingsMenu.d.ts +12 -12
  122. package/lib/esm/ui/widget/MapLayerSettingsMenu.js +78 -78
  123. package/lib/esm/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  124. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.d.ts +7 -7
  125. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js +61 -61
  126. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  127. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.scss +20 -20
  128. package/lib/esm/ui/widget/MapLayersWidget.d.ts +11 -11
  129. package/lib/esm/ui/widget/MapLayersWidget.js +27 -27
  130. package/lib/esm/ui/widget/MapLayersWidget.js.map +1 -1
  131. package/lib/esm/ui/widget/MapManagerSettings.d.ts +3 -3
  132. package/lib/esm/ui/widget/MapManagerSettings.js +196 -196
  133. package/lib/esm/ui/widget/MapManagerSettings.js.map +1 -1
  134. package/lib/esm/ui/widget/MapManagerSettings.scss +29 -29
  135. package/lib/esm/ui/widget/MapUrlDialog.d.ts +23 -23
  136. package/lib/esm/ui/widget/MapUrlDialog.d.ts.map +1 -1
  137. package/lib/esm/ui/widget/MapUrlDialog.js +526 -520
  138. package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
  139. package/lib/esm/ui/widget/MapUrlDialog.scss +100 -100
  140. package/lib/esm/ui/widget/SelectMapFormat.d.ts +18 -18
  141. package/lib/esm/ui/widget/SelectMapFormat.js +50 -50
  142. package/lib/esm/ui/widget/SelectMapFormat.js.map +1 -1
  143. package/lib/esm/ui/widget/SubLayersDataProvider.d.ts +20 -20
  144. package/lib/esm/ui/widget/SubLayersDataProvider.js +71 -71
  145. package/lib/esm/ui/widget/SubLayersDataProvider.js.map +1 -1
  146. package/lib/esm/ui/widget/SubLayersPopupButton.d.ts +10 -10
  147. package/lib/esm/ui/widget/SubLayersPopupButton.js +36 -36
  148. package/lib/esm/ui/widget/SubLayersPopupButton.js.map +1 -1
  149. package/lib/esm/ui/widget/SubLayersTree.d.ts +15 -15
  150. package/lib/esm/ui/widget/SubLayersTree.js +408 -408
  151. package/lib/esm/ui/widget/SubLayersTree.js.map +1 -1
  152. package/lib/esm/ui/widget/SubLayersTree.scss +69 -69
  153. package/lib/esm/ui/widget/TransparencyPopupButton.d.ts +14 -14
  154. package/lib/esm/ui/widget/TransparencyPopupButton.js +43 -43
  155. package/lib/esm/ui/widget/TransparencyPopupButton.js.map +1 -1
  156. package/lib/esm/ui/widget/TransparencyPopupButton.scss +36 -36
  157. package/package.json +16 -16
@@ -1,13 +1,13 @@
1
- /// <reference types="react" />
2
- import { ScreenViewport } from "@itwin/core-frontend";
3
- import "./MapLayerManager.scss";
4
- import { StyleMapLayerSettings } from "../Interfaces";
5
- interface MapLayerSettingsMenuProps {
6
- mapLayerSettings: StyleMapLayerSettings;
7
- onMenuItemSelection: (action: string, mapLayerSettings: StyleMapLayerSettings) => void;
8
- activeViewport: ScreenViewport;
9
- disabled?: boolean;
10
- }
11
- export declare function MapLayerSettingsMenu({ mapLayerSettings, onMenuItemSelection, activeViewport, disabled }: MapLayerSettingsMenuProps): JSX.Element;
12
- export {};
1
+ /// <reference types="react" />
2
+ import { ScreenViewport } from "@itwin/core-frontend";
3
+ import "./MapLayerManager.scss";
4
+ import { StyleMapLayerSettings } from "../Interfaces";
5
+ interface MapLayerSettingsMenuProps {
6
+ mapLayerSettings: StyleMapLayerSettings;
7
+ onMenuItemSelection: (action: string, mapLayerSettings: StyleMapLayerSettings) => void;
8
+ activeViewport: ScreenViewport;
9
+ disabled?: boolean;
10
+ }
11
+ export declare function MapLayerSettingsMenu({ mapLayerSettings, onMenuItemSelection, activeViewport, disabled }: MapLayerSettingsMenuProps): JSX.Element;
12
+ export {};
13
13
  //# sourceMappingURL=MapLayerSettingsMenu.d.ts.map
@@ -1,79 +1,79 @@
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 * as React from "react";
6
- import { ContextMenu, ContextMenuItem } from "@itwin/core-react";
7
- import { Button, Slider } from "@itwin/itwinui-react";
8
- import "./MapLayerManager.scss";
9
- import { MapLayersUI } from "../../mapLayers";
10
- // eslint-disable-next-line @typescript-eslint/naming-convention
11
- export function MapLayerSettingsMenu({ mapLayerSettings, onMenuItemSelection, activeViewport, disabled }) {
12
- const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);
13
- const settingsRef = React.useRef(null);
14
- const [labelDetach] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:LayerMenu.Detach"));
15
- const [labelZoomToLayer] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:LayerMenu.ZoomToLayer"));
16
- const [hasRangeData, setHasRangeData] = React.useState();
17
- const [transparency, setTransparency] = React.useState(mapLayerSettings.transparency);
18
- React.useEffect(() => {
19
- async function fetchRangeData() {
20
- let hasRange = false;
21
- const indexInDisplayStyle = activeViewport?.displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);
22
- if (undefined !== indexInDisplayStyle) {
23
- hasRange = (undefined !== await activeViewport.displayStyle.getMapLayerRange(indexInDisplayStyle, mapLayerSettings.isOverlay));
24
- }
25
- setHasRangeData(hasRange);
26
- }
27
- fetchRangeData(); // eslint-disable-line @typescript-eslint/no-floating-promises
28
- }, [activeViewport, mapLayerSettings]);
29
- const onSettingsClick = React.useCallback(() => {
30
- setIsSettingsOpen((prev) => !prev);
31
- }, [setIsSettingsOpen]);
32
- const handleCloseSetting = React.useCallback(() => {
33
- setIsSettingsOpen(false);
34
- }, [setIsSettingsOpen]);
35
- const handleRemoveLayer = React.useCallback(() => {
36
- setIsSettingsOpen(false);
37
- onMenuItemSelection("delete", mapLayerSettings);
38
- }, [setIsSettingsOpen, onMenuItemSelection, mapLayerSettings]);
39
- const handleZoomToLayer = React.useCallback(() => {
40
- setIsSettingsOpen(false);
41
- onMenuItemSelection("zoom-to-layer", mapLayerSettings);
42
- }, [setIsSettingsOpen, onMenuItemSelection, mapLayerSettings]);
43
- const applyTransparencyChange = React.useCallback((value) => {
44
- if (activeViewport) {
45
- const newTransparency = value;
46
- const displayStyle = activeViewport.displayStyle;
47
- const indexInDisplayStyle = displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);
48
- if (-1 !== indexInDisplayStyle) {
49
- const styleTransparency = displayStyle.mapLayerAtIndex(indexInDisplayStyle, mapLayerSettings.isOverlay)?.transparency;
50
- const styleTransparencyValue = styleTransparency ? styleTransparency : 0;
51
- if (Math.abs(styleTransparencyValue - newTransparency) > 0.01) {
52
- // update the display style
53
- displayStyle.changeMapLayerProps({ transparency: newTransparency }, indexInDisplayStyle, mapLayerSettings.isOverlay);
54
- activeViewport.invalidateRenderPlan();
55
- // force UI to update
56
- // loadMapLayerSettingsFromStyle(activeViewport.displayStyle);
57
- }
58
- }
59
- }
60
- }, [activeViewport, mapLayerSettings]);
61
- const handleTransparencyChange = React.useCallback((values) => {
62
- if (values.length) {
63
- const newTransparency = values[0] / 100.0;
64
- if (newTransparency !== transparency) {
65
- setTransparency(newTransparency);
66
- applyTransparencyChange(newTransparency);
67
- }
68
- }
69
- }, [transparency, applyTransparencyChange]);
70
- return (React.createElement(React.Fragment, null,
71
- React.createElement(Button, { disabled: disabled, size: "small", styleType: "borderless", "data-testid": "map-layer-settings", className: "map-layer-settings icon icon-more-vertical-2", ref: settingsRef, onClick: onSettingsClick }),
72
- React.createElement(ContextMenu, { opened: isSettingsOpen && (undefined !== hasRangeData), onOutsideClick: handleCloseSetting },
73
- React.createElement("div", { className: "map-manager-item-menu" },
74
- React.createElement(ContextMenuItem, { hideIconContainer: true, key: 0, className: hasRangeData ? "" : "core-context-menu-disabled", onSelect: handleZoomToLayer }, labelZoomToLayer),
75
- React.createElement(ContextMenuItem, { hideIconContainer: true, key: 1, onSelect: handleRemoveLayer }, labelDetach),
76
- React.createElement(ContextMenuItem, { hideIconContainer: true, key: 2 },
77
- React.createElement(Slider, { min: 0, max: 100, values: [transparency * 100], step: 1, onChange: handleTransparencyChange }))))));
78
- }
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 * as React from "react";
6
+ import { ContextMenu, ContextMenuItem } from "@itwin/core-react";
7
+ import { Button, Slider } from "@itwin/itwinui-react";
8
+ import "./MapLayerManager.scss";
9
+ import { MapLayersUI } from "../../mapLayers";
10
+ // eslint-disable-next-line @typescript-eslint/naming-convention
11
+ export function MapLayerSettingsMenu({ mapLayerSettings, onMenuItemSelection, activeViewport, disabled }) {
12
+ const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);
13
+ const settingsRef = React.useRef(null);
14
+ const [labelDetach] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:LayerMenu.Detach"));
15
+ const [labelZoomToLayer] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:LayerMenu.ZoomToLayer"));
16
+ const [hasRangeData, setHasRangeData] = React.useState();
17
+ const [transparency, setTransparency] = React.useState(mapLayerSettings.transparency);
18
+ React.useEffect(() => {
19
+ async function fetchRangeData() {
20
+ let hasRange = false;
21
+ const indexInDisplayStyle = activeViewport?.displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);
22
+ if (undefined !== indexInDisplayStyle) {
23
+ hasRange = (undefined !== await activeViewport.displayStyle.getMapLayerRange(indexInDisplayStyle, mapLayerSettings.isOverlay));
24
+ }
25
+ setHasRangeData(hasRange);
26
+ }
27
+ fetchRangeData(); // eslint-disable-line @typescript-eslint/no-floating-promises
28
+ }, [activeViewport, mapLayerSettings]);
29
+ const onSettingsClick = React.useCallback(() => {
30
+ setIsSettingsOpen((prev) => !prev);
31
+ }, [setIsSettingsOpen]);
32
+ const handleCloseSetting = React.useCallback(() => {
33
+ setIsSettingsOpen(false);
34
+ }, [setIsSettingsOpen]);
35
+ const handleRemoveLayer = React.useCallback(() => {
36
+ setIsSettingsOpen(false);
37
+ onMenuItemSelection("delete", mapLayerSettings);
38
+ }, [setIsSettingsOpen, onMenuItemSelection, mapLayerSettings]);
39
+ const handleZoomToLayer = React.useCallback(() => {
40
+ setIsSettingsOpen(false);
41
+ onMenuItemSelection("zoom-to-layer", mapLayerSettings);
42
+ }, [setIsSettingsOpen, onMenuItemSelection, mapLayerSettings]);
43
+ const applyTransparencyChange = React.useCallback((value) => {
44
+ if (activeViewport) {
45
+ const newTransparency = value;
46
+ const displayStyle = activeViewport.displayStyle;
47
+ const indexInDisplayStyle = displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);
48
+ if (-1 !== indexInDisplayStyle) {
49
+ const styleTransparency = displayStyle.mapLayerAtIndex(indexInDisplayStyle, mapLayerSettings.isOverlay)?.transparency;
50
+ const styleTransparencyValue = styleTransparency ? styleTransparency : 0;
51
+ if (Math.abs(styleTransparencyValue - newTransparency) > 0.01) {
52
+ // update the display style
53
+ displayStyle.changeMapLayerProps({ transparency: newTransparency }, indexInDisplayStyle, mapLayerSettings.isOverlay);
54
+ activeViewport.invalidateRenderPlan();
55
+ // force UI to update
56
+ // loadMapLayerSettingsFromStyle(activeViewport.displayStyle);
57
+ }
58
+ }
59
+ }
60
+ }, [activeViewport, mapLayerSettings]);
61
+ const handleTransparencyChange = React.useCallback((values) => {
62
+ if (values.length) {
63
+ const newTransparency = values[0] / 100.0;
64
+ if (newTransparency !== transparency) {
65
+ setTransparency(newTransparency);
66
+ applyTransparencyChange(newTransparency);
67
+ }
68
+ }
69
+ }, [transparency, applyTransparencyChange]);
70
+ return (React.createElement(React.Fragment, null,
71
+ React.createElement(Button, { disabled: disabled, size: "small", styleType: "borderless", "data-testid": "map-layer-settings", className: "map-layer-settings icon icon-more-vertical-2", ref: settingsRef, onClick: onSettingsClick }),
72
+ React.createElement(ContextMenu, { opened: isSettingsOpen && (undefined !== hasRangeData), onOutsideClick: handleCloseSetting },
73
+ React.createElement("div", { className: "map-manager-item-menu" },
74
+ React.createElement(ContextMenuItem, { hideIconContainer: true, key: 0, className: hasRangeData ? "" : "core-context-menu-disabled", onSelect: handleZoomToLayer }, labelZoomToLayer),
75
+ React.createElement(ContextMenuItem, { hideIconContainer: true, key: 1, onSelect: handleRemoveLayer }, labelDetach),
76
+ React.createElement(ContextMenuItem, { hideIconContainer: true, key: 2 },
77
+ React.createElement(Slider, { min: 0, max: 100, values: [transparency * 100], step: 1, onChange: handleTransparencyChange }))))));
78
+ }
79
79
  //# sourceMappingURL=MapLayerSettingsMenu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MapLayerSettingsMenu.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerSettingsMenu.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,wBAAwB,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAS9C,gEAAgE;AAChE,MAAM,UAAU,oBAAoB,CAAC,EAAE,gBAAgB,E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C,uBAAuB;gBACpC,oBAAC,eAAe,IAAC,iBAAiB,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,4BAA4B,EAAE,QAAQ,EAAE,iBAAiB,IAAG,gBAAgB,CAAmB;gBAChL,oBAAC,eAAe,IAAC,iBAAiB,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,QAAQ,EAAE,iBAAiB,IAAG,WAAW,CAAmB;gBAC9G,oBAAC,eAAe,IAAC,iBAAiB,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;oBAC9C,oBAAC,MAAM,IAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,YAAY,GAAG,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,wBAAwB,GAAI,CACvF,CACd,CACM,CACb,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*--------------------------------------------------------------------------------------------*/\nimport * as React from \"react\";\nimport { ScreenViewport } from \"@itwin/core-frontend\";\nimport { ContextMenu, ContextMenuItem } from \"@itwin/core-react\";\nimport { Button, Slider } from \"@itwin/itwinui-react\";\nimport \"./MapLayerManager.scss\";\nimport { StyleMapLayerSettings } from \"../Interfaces\";\nimport { MapLayersUI } from \"../../mapLayers\";\n\ninterface MapLayerSettingsMenuProps {\n mapLayerSettings: StyleMapLayerSettings;\n onMenuItemSelection: (action: string, mapLayerSettings: StyleMapLayerSettings) => void;\n activeViewport: ScreenViewport;\n disabled?: boolean;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function MapLayerSettingsMenu({ mapLayerSettings, onMenuItemSelection, activeViewport, disabled }: MapLayerSettingsMenuProps) {\n const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);\n const settingsRef = React.useRef<HTMLButtonElement>(null);\n const [labelDetach] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:LayerMenu.Detach\"));\n const [labelZoomToLayer] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:LayerMenu.ZoomToLayer\"));\n const [hasRangeData, setHasRangeData] = React.useState<boolean | undefined>();\n const [transparency, setTransparency] = React.useState(mapLayerSettings.transparency);\n\n React.useEffect(() => {\n async function fetchRangeData() {\n let hasRange = false;\n const indexInDisplayStyle = activeViewport?.displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);\n if (undefined !== indexInDisplayStyle) {\n hasRange = (undefined !== await activeViewport.displayStyle.getMapLayerRange(indexInDisplayStyle, mapLayerSettings.isOverlay));\n }\n setHasRangeData(hasRange);\n }\n fetchRangeData(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }, [activeViewport, mapLayerSettings]);\n\n const onSettingsClick = React.useCallback(() => {\n setIsSettingsOpen((prev) => !prev);\n }, [setIsSettingsOpen]);\n\n const handleCloseSetting = React.useCallback(() => {\n setIsSettingsOpen(false);\n }, [setIsSettingsOpen]);\n\n const handleRemoveLayer = React.useCallback(() => {\n setIsSettingsOpen(false);\n onMenuItemSelection(\"delete\", mapLayerSettings);\n }, [setIsSettingsOpen, onMenuItemSelection, mapLayerSettings]);\n\n const handleZoomToLayer = React.useCallback(() => {\n setIsSettingsOpen(false);\n onMenuItemSelection(\"zoom-to-layer\", mapLayerSettings);\n }, [setIsSettingsOpen, onMenuItemSelection, mapLayerSettings]);\n\n const applyTransparencyChange = React.useCallback((value: number) => {\n if (activeViewport) {\n const newTransparency = value;\n const displayStyle = activeViewport.displayStyle;\n const indexInDisplayStyle = displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);\n if (-1 !== indexInDisplayStyle) {\n const styleTransparency = displayStyle.mapLayerAtIndex(indexInDisplayStyle, mapLayerSettings.isOverlay)?.transparency;\n const styleTransparencyValue = styleTransparency ? styleTransparency : 0;\n if (Math.abs(styleTransparencyValue - newTransparency) > 0.01) {\n // update the display style\n displayStyle.changeMapLayerProps({ transparency: newTransparency }, indexInDisplayStyle, mapLayerSettings.isOverlay);\n activeViewport.invalidateRenderPlan();\n\n // force UI to update\n // loadMapLayerSettingsFromStyle(activeViewport.displayStyle);\n }\n }\n }\n }, [activeViewport, mapLayerSettings]);\n\n const handleTransparencyChange = React.useCallback((values: readonly number[]) => {\n if (values.length) {\n const newTransparency = values[0] / 100.0;\n if (newTransparency !== transparency) {\n setTransparency(newTransparency);\n applyTransparencyChange(newTransparency);\n }\n }\n }, [transparency, applyTransparencyChange]);\n\n return (\n <>\n <Button disabled={disabled} size=\"small\" styleType=\"borderless\" data-testid=\"map-layer-settings\" className=\"map-layer-settings icon icon-more-vertical-2\" ref={settingsRef} onClick={onSettingsClick} ></Button>\n <ContextMenu opened={isSettingsOpen && (undefined !== hasRangeData)} onOutsideClick={handleCloseSetting} >\n <div className=\"map-manager-item-menu\" >\n <ContextMenuItem hideIconContainer={true} key={0} className={hasRangeData ? \"\" : \"core-context-menu-disabled\"} onSelect={handleZoomToLayer}>{labelZoomToLayer}</ContextMenuItem>\n <ContextMenuItem hideIconContainer={true} key={1} onSelect={handleRemoveLayer}>{labelDetach}</ContextMenuItem>\n <ContextMenuItem hideIconContainer={true} key={2} >\n <Slider min={0} max={100} values={[transparency * 100]} step={1} onChange={handleTransparencyChange} />\n </ContextMenuItem>\n </div>\n </ContextMenu>\n </>\n );\n}\n"]}
1
+ {"version":3,"file":"MapLayerSettingsMenu.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerSettingsMenu.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACjE,OA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AAC,8CAA8C,EAAC,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,eAAe,GAAY;QAChN,oBAAC,WAAW,IAAC,MAAM,EAAE,cAAc,IAAI,CAAC,SAAS,KAAK,YAAY,CAAC,EAAE,cAAc,EAAE,kBAAkB;YACrG,6BAAK,SAAS,EAAC,uBAAuB;gBACpC,oBAAC,eAAe,IAAC,iBAAiB,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,4BAA4B,EAAE,QAAQ,EAAE,iBAAiB,IAAG,gBAAgB,CAAmB;gBAChL,oBAAC,eAAe,IAAC,iBAAiB,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,QAAQ,EAAE,iBAAiB,IAAG,WAAW,CAAmB;gBAC9G,oBAAC,eAAe,IAAC,iBAAiB,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;oBAC9C,oBAAC,MAAM,IAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,YAAY,GAAG,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,wBAAwB,GAAI,CACvF,CACd,CACM,CACb,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\nimport * as React from \"react\";\r\nimport { ScreenViewport } from \"@itwin/core-frontend\";\r\nimport { ContextMenu, ContextMenuItem } from \"@itwin/core-react\";\r\nimport { Button, Slider } from \"@itwin/itwinui-react\";\r\nimport \"./MapLayerManager.scss\";\r\nimport { StyleMapLayerSettings } from \"../Interfaces\";\r\nimport { MapLayersUI } from \"../../mapLayers\";\r\n\r\ninterface MapLayerSettingsMenuProps {\r\n mapLayerSettings: StyleMapLayerSettings;\r\n onMenuItemSelection: (action: string, mapLayerSettings: StyleMapLayerSettings) => void;\r\n activeViewport: ScreenViewport;\r\n disabled?: boolean;\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function MapLayerSettingsMenu({ mapLayerSettings, onMenuItemSelection, activeViewport, disabled }: MapLayerSettingsMenuProps) {\r\n const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);\r\n const settingsRef = React.useRef<HTMLButtonElement>(null);\r\n const [labelDetach] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:LayerMenu.Detach\"));\r\n const [labelZoomToLayer] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:LayerMenu.ZoomToLayer\"));\r\n const [hasRangeData, setHasRangeData] = React.useState<boolean | undefined>();\r\n const [transparency, setTransparency] = React.useState(mapLayerSettings.transparency);\r\n\r\n React.useEffect(() => {\r\n async function fetchRangeData() {\r\n let hasRange = false;\r\n const indexInDisplayStyle = activeViewport?.displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);\r\n if (undefined !== indexInDisplayStyle) {\r\n hasRange = (undefined !== await activeViewport.displayStyle.getMapLayerRange(indexInDisplayStyle, mapLayerSettings.isOverlay));\r\n }\r\n setHasRangeData(hasRange);\r\n }\r\n fetchRangeData(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n }, [activeViewport, mapLayerSettings]);\r\n\r\n const onSettingsClick = React.useCallback(() => {\r\n setIsSettingsOpen((prev) => !prev);\r\n }, [setIsSettingsOpen]);\r\n\r\n const handleCloseSetting = React.useCallback(() => {\r\n setIsSettingsOpen(false);\r\n }, [setIsSettingsOpen]);\r\n\r\n const handleRemoveLayer = React.useCallback(() => {\r\n setIsSettingsOpen(false);\r\n onMenuItemSelection(\"delete\", mapLayerSettings);\r\n }, [setIsSettingsOpen, onMenuItemSelection, mapLayerSettings]);\r\n\r\n const handleZoomToLayer = React.useCallback(() => {\r\n setIsSettingsOpen(false);\r\n onMenuItemSelection(\"zoom-to-layer\", mapLayerSettings);\r\n }, [setIsSettingsOpen, onMenuItemSelection, mapLayerSettings]);\r\n\r\n const applyTransparencyChange = React.useCallback((value: number) => {\r\n if (activeViewport) {\r\n const newTransparency = value;\r\n const displayStyle = activeViewport.displayStyle;\r\n const indexInDisplayStyle = displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);\r\n if (-1 !== indexInDisplayStyle) {\r\n const styleTransparency = displayStyle.mapLayerAtIndex(indexInDisplayStyle, mapLayerSettings.isOverlay)?.transparency;\r\n const styleTransparencyValue = styleTransparency ? styleTransparency : 0;\r\n if (Math.abs(styleTransparencyValue - newTransparency) > 0.01) {\r\n // update the display style\r\n displayStyle.changeMapLayerProps({ transparency: newTransparency }, indexInDisplayStyle, mapLayerSettings.isOverlay);\r\n activeViewport.invalidateRenderPlan();\r\n\r\n // force UI to update\r\n // loadMapLayerSettingsFromStyle(activeViewport.displayStyle);\r\n }\r\n }\r\n }\r\n }, [activeViewport, mapLayerSettings]);\r\n\r\n const handleTransparencyChange = React.useCallback((values: readonly number[]) => {\r\n if (values.length) {\r\n const newTransparency = values[0] / 100.0;\r\n if (newTransparency !== transparency) {\r\n setTransparency(newTransparency);\r\n applyTransparencyChange(newTransparency);\r\n }\r\n }\r\n }, [transparency, applyTransparencyChange]);\r\n\r\n return (\r\n <>\r\n <Button disabled={disabled} size=\"small\" styleType=\"borderless\" data-testid=\"map-layer-settings\" className=\"map-layer-settings icon icon-more-vertical-2\" ref={settingsRef} onClick={onSettingsClick} ></Button>\r\n <ContextMenu opened={isSettingsOpen && (undefined !== hasRangeData)} onOutsideClick={handleCloseSetting} >\r\n <div className=\"map-manager-item-menu\" >\r\n <ContextMenuItem hideIconContainer={true} key={0} className={hasRangeData ? \"\" : \"core-context-menu-disabled\"} onSelect={handleZoomToLayer}>{labelZoomToLayer}</ContextMenuItem>\r\n <ContextMenuItem hideIconContainer={true} key={1} onSelect={handleRemoveLayer}>{labelDetach}</ContextMenuItem>\r\n <ContextMenuItem hideIconContainer={true} key={2} >\r\n <Slider min={0} max={100} values={[transparency * 100]} step={1} onChange={handleTransparencyChange} />\r\n </ContextMenuItem>\r\n </div>\r\n </ContextMenu>\r\n </>\r\n );\r\n}\r\n"]}
@@ -1,8 +1,8 @@
1
- /// <reference types="react" />
2
- import "./MapLayerSettingsPopupButton.scss";
3
- export interface MapLayerSettingsPopupButtonProps {
4
- disabled?: boolean;
5
- }
6
- /** @alpha */
7
- export declare function MapLayerSettingsPopupButton(props: MapLayerSettingsPopupButtonProps): JSX.Element;
1
+ /// <reference types="react" />
2
+ import "./MapLayerSettingsPopupButton.scss";
3
+ export interface MapLayerSettingsPopupButtonProps {
4
+ disabled?: boolean;
5
+ }
6
+ /** @alpha */
7
+ export declare function MapLayerSettingsPopupButton(props: MapLayerSettingsPopupButtonProps): JSX.Element;
8
8
  //# sourceMappingURL=MapLayerSettingsPopupButton.d.ts.map
@@ -1,62 +1,62 @@
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 * as React from "react";
6
- import { RelativePosition } from "@itwin/appui-abstract";
7
- import { Popup, WebFontIcon } from "@itwin/core-react";
8
- import { MapManagerSettings } from "./MapManagerSettings";
9
- import "./MapLayerSettingsPopupButton.scss";
10
- import { MapLayersUI } from "../../mapLayers";
11
- import { Button } from "@itwin/itwinui-react";
12
- /** @alpha */
13
- // eslint-disable-next-line @typescript-eslint/naming-convention
14
- export function MapLayerSettingsPopupButton(props) {
15
- const panelRef = React.useRef(null);
16
- const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);
17
- const [buttonTooltip] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:Widget.SettingsButtonTooltip"));
18
- const buttonRef = React.useRef(null);
19
- const togglePopupDisplay = React.useCallback((event) => {
20
- event.preventDefault();
21
- setIsSettingsOpen((prev) => !prev);
22
- }, [setIsSettingsOpen]);
23
- const handleCloseSetting = React.useCallback(() => {
24
- setIsSettingsOpen(false);
25
- }, [setIsSettingsOpen]);
26
- const isInsideCoreDialog = React.useCallback((element) => {
27
- if (element.nodeName === "DIV") {
28
- if (element.classList && element.classList.contains("core-dialog"))
29
- return true;
30
- if (element.parentElement && isInsideCoreDialog(element.parentElement))
31
- return true;
32
- }
33
- else {
34
- // istanbul ignore else
35
- if (element.parentElement && isInsideCoreDialog(element.parentElement))
36
- return true;
37
- }
38
- return false;
39
- }, []);
40
- const handleOutsideClick = React.useCallback((event) => {
41
- if (isInsideCoreDialog(event.target)) {
42
- return;
43
- }
44
- // If clicking on button that open panel - don't trigger outside click processing
45
- if (buttonRef?.current && buttonRef?.current.contains(event.target)) {
46
- return;
47
- }
48
- // If clicking the panel, this is not an outside clicked
49
- if (panelRef.current && panelRef?.current.contains(event.target)) {
50
- return;
51
- }
52
- // If we reach this point, we got an outside clicked, no close the popup
53
- setIsSettingsOpen(false);
54
- }, [isInsideCoreDialog]);
55
- return (React.createElement(React.Fragment, null,
56
- React.createElement(Button, { disabled: props.disabled, styleType: "borderless", title: buttonTooltip, className: "maplayers-settings-popup-button", onClick: togglePopupDisplay, ref: buttonRef },
57
- React.createElement(WebFontIcon, { iconName: "icon-settings" })),
58
- React.createElement(Popup, { isOpen: isSettingsOpen, position: RelativePosition.BottomRight, onClose: handleCloseSetting, target: buttonRef.current, onOutsideClick: handleOutsideClick, repositionOnResize: true },
59
- React.createElement("div", { ref: panelRef, className: "maplayers-settings-popup-panel" },
60
- React.createElement(MapManagerSettings, null)))));
61
- }
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 * as React from "react";
6
+ import { RelativePosition } from "@itwin/appui-abstract";
7
+ import { Popup, WebFontIcon } from "@itwin/core-react";
8
+ import { MapManagerSettings } from "./MapManagerSettings";
9
+ import "./MapLayerSettingsPopupButton.scss";
10
+ import { MapLayersUI } from "../../mapLayers";
11
+ import { Button } from "@itwin/itwinui-react";
12
+ /** @alpha */
13
+ // eslint-disable-next-line @typescript-eslint/naming-convention
14
+ export function MapLayerSettingsPopupButton(props) {
15
+ const panelRef = React.useRef(null);
16
+ const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);
17
+ const [buttonTooltip] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:Widget.SettingsButtonTooltip"));
18
+ const buttonRef = React.useRef(null);
19
+ const togglePopupDisplay = React.useCallback((event) => {
20
+ event.preventDefault();
21
+ setIsSettingsOpen((prev) => !prev);
22
+ }, [setIsSettingsOpen]);
23
+ const handleCloseSetting = React.useCallback(() => {
24
+ setIsSettingsOpen(false);
25
+ }, [setIsSettingsOpen]);
26
+ const isInsideCoreDialog = React.useCallback((element) => {
27
+ if (element.nodeName === "DIV") {
28
+ if (element.classList && element.classList.contains("core-dialog"))
29
+ return true;
30
+ if (element.parentElement && isInsideCoreDialog(element.parentElement))
31
+ return true;
32
+ }
33
+ else {
34
+ // istanbul ignore else
35
+ if (element.parentElement && isInsideCoreDialog(element.parentElement))
36
+ return true;
37
+ }
38
+ return false;
39
+ }, []);
40
+ const handleOutsideClick = React.useCallback((event) => {
41
+ if (isInsideCoreDialog(event.target)) {
42
+ return;
43
+ }
44
+ // If clicking on button that open panel - don't trigger outside click processing
45
+ if (buttonRef?.current && buttonRef?.current.contains(event.target)) {
46
+ return;
47
+ }
48
+ // If clicking the panel, this is not an outside clicked
49
+ if (panelRef.current && panelRef?.current.contains(event.target)) {
50
+ return;
51
+ }
52
+ // If we reach this point, we got an outside clicked, no close the popup
53
+ setIsSettingsOpen(false);
54
+ }, [isInsideCoreDialog]);
55
+ return (React.createElement(React.Fragment, null,
56
+ React.createElement(Button, { disabled: props.disabled, styleType: "borderless", title: buttonTooltip, className: "maplayers-settings-popup-button", onClick: togglePopupDisplay, ref: buttonRef },
57
+ React.createElement(WebFontIcon, { iconName: "icon-settings" })),
58
+ React.createElement(Popup, { isOpen: isSettingsOpen, position: RelativePosition.BottomRight, onClose: handleCloseSetting, target: buttonRef.current, onOutsideClick: handleOutsideClick, repositionOnResize: true },
59
+ React.createElement("div", { ref: panelRef, className: "maplayers-settings-popup-panel" },
60
+ React.createElement(MapManagerSettings, null)))));
61
+ }
62
62
  //# sourceMappingURL=MapLayerSettingsPopupButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MapLayerSettingsPopupButton.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerSettingsPopupButton.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,oCAAoC,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAK9C,aAAa;AACb,gEAAgE;AAChE,MAAM,UAAU,2BAA2B,CAAC,KAAuC;IACjF,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAiB,IAAI,CAAC,CAAC;IACpD,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClE,MAAM,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,wCAAwC,CAAC,CAAC,CAAC;IAE9H,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAoB,IAAI,C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,QAAQ,CAAC,OAAO,IAAI,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAc,CAAC,EAAE;YACxE,OAAO;SACR;QAED,wEAAwE;QACxE,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAE3B,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAEzB,OAAO,CACL;QACE,oBAAC,MAAM,IAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAC,YAAY,EAAC,KAAK,EAAE,aAAa,EAAE,SAAS,EAAC,iCAAiC,EAAC,OAAO,EAAE,kBAAkB,EAAE,GAAG,EAAE,SAAS;YACpK,oBAAC,WAAW,IAAC,QAAQ,EAAC,eAAe,GAAG,CACjC;QACT,oBAAC,KAAK,IACJ,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,gBAAgB,CAAC,WAAW,EACtC,OAAO,EAAE,kBAAkB,EAC3B,MAAM,EAAE,SAAS,CAAC,OAAO,EACzB,cAAc,EAAE,kBAAkB,EAClC,kBAAkB,EAAE,IAAI;YAExB,6BAAK,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,gCAAgC;gBAC5D,oBAAC,kBAAkB,OAAG,CAClB,CACC,CACP,CACL,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\nimport * as React from \"react\";\nimport { RelativePosition } from \"@itwin/appui-abstract\";\nimport { Popup, WebFontIcon } from \"@itwin/core-react\";\nimport { MapManagerSettings } from \"./MapManagerSettings\";\n\nimport \"./MapLayerSettingsPopupButton.scss\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport { Button } from \"@itwin/itwinui-react\";\nexport interface MapLayerSettingsPopupButtonProps {\n disabled?: boolean;\n}\n\n/** @alpha */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function MapLayerSettingsPopupButton(props: MapLayerSettingsPopupButtonProps) {\n const panelRef = React.useRef<HTMLDivElement>(null);\n const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);\n const [buttonTooltip] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.SettingsButtonTooltip\"));\n\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n const togglePopupDisplay = React.useCallback((event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n event.preventDefault();\n setIsSettingsOpen((prev) => !prev);\n }, [setIsSettingsOpen]);\n\n const handleCloseSetting = React.useCallback(() => {\n setIsSettingsOpen(false);\n }, [setIsSettingsOpen]);\n\n const isInsideCoreDialog = React.useCallback((element: HTMLElement) => {\n if (element.nodeName === \"DIV\") {\n if (element.classList && element.classList.contains(\"core-dialog\"))\n return true;\n if (element.parentElement && isInsideCoreDialog(element.parentElement))\n return true;\n } else {\n // istanbul ignore else\n if (element.parentElement && isInsideCoreDialog(element.parentElement))\n return true;\n }\n return false;\n }, []);\n\n const handleOutsideClick = React.useCallback((event: MouseEvent) => {\n if (isInsideCoreDialog(event.target as HTMLElement)) {\n return;\n }\n\n // If clicking on button that open panel - don't trigger outside click processing\n if (buttonRef?.current && buttonRef?.current.contains(event.target as Node)) {\n return;\n }\n\n // If clicking the panel, this is not an outside clicked\n if (panelRef.current && panelRef?.current.contains(event.target as Node)) {\n return;\n }\n\n // If we reach this point, we got an outside clicked, no close the popup\n setIsSettingsOpen(false);\n\n }, [isInsideCoreDialog]);\n\n return (\n <>\n <Button disabled={props.disabled} styleType=\"borderless\" title={buttonTooltip} className=\"maplayers-settings-popup-button\" onClick={togglePopupDisplay} ref={buttonRef}>\n <WebFontIcon iconName=\"icon-settings\" />\n </Button>\n <Popup\n isOpen={isSettingsOpen}\n position={RelativePosition.BottomRight}\n onClose={handleCloseSetting}\n target={buttonRef.current}\n onOutsideClick={handleOutsideClick}\n repositionOnResize={true}\n >\n <div ref={panelRef} className=\"maplayers-settings-popup-panel\">\n <MapManagerSettings />\n </div>\n </Popup >\n </ >\n );\n}\n"]}
1
+ {"version":3,"file":"MapLayerSettingsPopupButton.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerSettingsPopupButton.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,oCAAoC,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAK9C,aAAa;AACb,gEAAgE;AAChE,MAAM,UAAU,2BAA2B,CAAC,KAAuC;IACjF,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAiB,IAAI,CAAC,CAAC;IACpD,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClE,MAAM,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,wCAAwC,CAAC,CAAC,CAAC;IAE9H,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAoB,IAAI,CAAC,CAAC;IACxD,MAAM,kBAAkB,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,KAAsD,EAAE,EAAE;QACtG,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,iBAAiB,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAExB,MAAM,kBAAkB,GAAG,KAAK,CAAC,WAAW,CAA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SAAS,EAAC,YAAY,EAAC,KAAK,EAAE,aAAa,EAAE,SAAS,EAAC,iCAAiC,EAAC,OAAO,EAAE,kBAAkB,EAAE,GAAG,EAAE,SAAS;YACpK,oBAAC,WAAW,IAAC,QAAQ,EAAC,eAAe,GAAG,CACjC;QACT,oBAAC,KAAK,IACJ,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,gBAAgB,CAAC,WAAW,EACtC,OAAO,EAAE,kBAAkB,EAC3B,MAAM,EAAE,SAAS,CAAC,OAAO,EACzB,cAAc,EAAE,kBAAkB,EAClC,kBAAkB,EAAE,IAAI;YAExB,6BAAK,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,gCAAgC;gBAC5D,oBAAC,kBAAkB,OAAG,CAClB,CACC,CACP,CACL,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\r\nimport * as React from \"react\";\r\nimport { RelativePosition } from \"@itwin/appui-abstract\";\r\nimport { Popup, WebFontIcon } from \"@itwin/core-react\";\r\nimport { MapManagerSettings } from \"./MapManagerSettings\";\r\n\r\nimport \"./MapLayerSettingsPopupButton.scss\";\r\nimport { MapLayersUI } from \"../../mapLayers\";\r\nimport { Button } from \"@itwin/itwinui-react\";\r\nexport interface MapLayerSettingsPopupButtonProps {\r\n disabled?: boolean;\r\n}\r\n\r\n/** @alpha */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function MapLayerSettingsPopupButton(props: MapLayerSettingsPopupButtonProps) {\r\n const panelRef = React.useRef<HTMLDivElement>(null);\r\n const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);\r\n const [buttonTooltip] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.SettingsButtonTooltip\"));\r\n\r\n const buttonRef = React.useRef<HTMLButtonElement>(null);\r\n const togglePopupDisplay = React.useCallback((event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\r\n event.preventDefault();\r\n setIsSettingsOpen((prev) => !prev);\r\n }, [setIsSettingsOpen]);\r\n\r\n const handleCloseSetting = React.useCallback(() => {\r\n setIsSettingsOpen(false);\r\n }, [setIsSettingsOpen]);\r\n\r\n const isInsideCoreDialog = React.useCallback((element: HTMLElement) => {\r\n if (element.nodeName === \"DIV\") {\r\n if (element.classList && element.classList.contains(\"core-dialog\"))\r\n return true;\r\n if (element.parentElement && isInsideCoreDialog(element.parentElement))\r\n return true;\r\n } else {\r\n // istanbul ignore else\r\n if (element.parentElement && isInsideCoreDialog(element.parentElement))\r\n return true;\r\n }\r\n return false;\r\n }, []);\r\n\r\n const handleOutsideClick = React.useCallback((event: MouseEvent) => {\r\n if (isInsideCoreDialog(event.target as HTMLElement)) {\r\n return;\r\n }\r\n\r\n // If clicking on button that open panel - don't trigger outside click processing\r\n if (buttonRef?.current && buttonRef?.current.contains(event.target as Node)) {\r\n return;\r\n }\r\n\r\n // If clicking the panel, this is not an outside clicked\r\n if (panelRef.current && panelRef?.current.contains(event.target as Node)) {\r\n return;\r\n }\r\n\r\n // If we reach this point, we got an outside clicked, no close the popup\r\n setIsSettingsOpen(false);\r\n\r\n }, [isInsideCoreDialog]);\r\n\r\n return (\r\n <>\r\n <Button disabled={props.disabled} styleType=\"borderless\" title={buttonTooltip} className=\"maplayers-settings-popup-button\" onClick={togglePopupDisplay} ref={buttonRef}>\r\n <WebFontIcon iconName=\"icon-settings\" />\r\n </Button>\r\n <Popup\r\n isOpen={isSettingsOpen}\r\n position={RelativePosition.BottomRight}\r\n onClose={handleCloseSetting}\r\n target={buttonRef.current}\r\n onOutsideClick={handleOutsideClick}\r\n repositionOnResize={true}\r\n >\r\n <div ref={panelRef} className=\"maplayers-settings-popup-panel\">\r\n <MapManagerSettings />\r\n </div>\r\n </Popup >\r\n </ >\r\n );\r\n}\r\n"]}
@@ -1,21 +1,21 @@
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
- $hovered-icon-color: $buic-foreground-primary;
8
-
9
- .maplayers-settings-popup-panel {
10
- z-index: 14000;
11
- font-size: 12px;
12
- margin: 0.5em;
13
- width: 340px;
14
- }
15
-
16
- .map-manager-header-buttons-group {
17
- .maplayers-settings-popup-button {
18
- position: relative;
19
- top: 1px;
20
- }
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
+ $hovered-icon-color: $buic-foreground-primary;
8
+
9
+ .maplayers-settings-popup-panel {
10
+ z-index: 14000;
11
+ font-size: 12px;
12
+ margin: 0.5em;
13
+ width: 340px;
14
+ }
15
+
16
+ .map-manager-header-buttons-group {
17
+ .maplayers-settings-popup-button {
18
+ position: relative;
19
+ top: 1px;
20
+ }
21
21
  }
@@ -1,12 +1,12 @@
1
- /// <reference types="react" />
2
- import { MapLayerOptions } from "../Interfaces";
3
- /**
4
- * Widget to Manage Map Layers
5
- * @beta
6
- */
7
- interface MapLayersWidgetProps {
8
- mapLayerOptions?: MapLayerOptions;
9
- }
10
- export declare function MapLayersWidget(props: MapLayersWidgetProps): JSX.Element;
11
- export {};
1
+ /// <reference types="react" />
2
+ import { MapLayerOptions } from "../Interfaces";
3
+ /**
4
+ * Widget to Manage Map Layers
5
+ * @beta
6
+ */
7
+ interface MapLayersWidgetProps {
8
+ mapLayerOptions?: MapLayerOptions;
9
+ }
10
+ export declare function MapLayersWidget(props: MapLayersWidgetProps): JSX.Element;
11
+ export {};
12
12
  //# sourceMappingURL=MapLayersWidget.d.ts.map
@@ -1,28 +1,28 @@
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 * as React from "react";
6
- import { useActiveViewport } from "@itwin/appui-react";
7
- import { FillCentered } from "@itwin/core-react";
8
- import { MapLayerManager } from "./MapLayerManager";
9
- import { MapLayersUI } from "../../mapLayers";
10
- // eslint-disable-next-line @typescript-eslint/naming-convention
11
- export function MapLayersWidget(props) {
12
- const [notGeoLocatedMsg] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:Messages.NotSupported"));
13
- const activeViewport = useActiveViewport();
14
- const ref = React.useRef(null);
15
- const [isGeoLocated, setIsGeoLocated] = React.useState(!!activeViewport?.iModel.isGeoLocated);
16
- React.useEffect(() => {
17
- const updateIsGeoLocated = () => setIsGeoLocated(!!activeViewport?.iModel.isGeoLocated);
18
- return activeViewport?.iModel.onEcefLocationChanged.addListener(updateIsGeoLocated);
19
- }, [activeViewport?.iModel]);
20
- if (activeViewport && isGeoLocated && activeViewport.view.isSpatialView())
21
- return (React.createElement("div", { ref: ref, className: "map-manager-layer-host" },
22
- React.createElement(MapLayerManager, { activeViewport: activeViewport, mapLayerOptions: props.mapLayerOptions, getContainerForClone: () => {
23
- return ref.current ? ref.current : document.body;
24
- } })));
25
- return (React.createElement(FillCentered, null,
26
- React.createElement("div", { className: "map-manager-not-geo-located-text" }, notGeoLocatedMsg)));
27
- }
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 * as React from "react";
6
+ import { useActiveViewport } from "@itwin/appui-react";
7
+ import { FillCentered } from "@itwin/core-react";
8
+ import { MapLayerManager } from "./MapLayerManager";
9
+ import { MapLayersUI } from "../../mapLayers";
10
+ // eslint-disable-next-line @typescript-eslint/naming-convention
11
+ export function MapLayersWidget(props) {
12
+ const [notGeoLocatedMsg] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:Messages.NotSupported"));
13
+ const activeViewport = useActiveViewport();
14
+ const ref = React.useRef(null);
15
+ const [isGeoLocated, setIsGeoLocated] = React.useState(!!activeViewport?.iModel.isGeoLocated);
16
+ React.useEffect(() => {
17
+ const updateIsGeoLocated = () => setIsGeoLocated(!!activeViewport?.iModel.isGeoLocated);
18
+ return activeViewport?.iModel.onEcefLocationChanged.addListener(updateIsGeoLocated);
19
+ }, [activeViewport?.iModel]);
20
+ if (activeViewport && isGeoLocated && activeViewport.view.isSpatialView())
21
+ return (React.createElement("div", { ref: ref, className: "map-manager-layer-host" },
22
+ React.createElement(MapLayerManager, { activeViewport: activeViewport, mapLayerOptions: props.mapLayerOptions, getContainerForClone: () => {
23
+ return ref.current ? ref.current : document.body;
24
+ } })));
25
+ return (React.createElement(FillCentered, null,
26
+ React.createElement("div", { className: "map-manager-not-geo-located-text" }, notGeoLocatedMsg)));
27
+ }
28
28
  //# sourceMappingURL=MapLayersWidget.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MapLayersWidget.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayersWidget.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAS9C,gEAAgE;AAChE,MAAM,UAAU,eAAe,CAAC,KAA2B;IACzD,MAAM,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,iCAAiC,CAAC,CAAC,CAAC;IAC1H,MAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;IAC3C,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAiB,IAAI,CAAC,CAAC;IAC/C,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAc,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;IAE9F,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,kBAAkB,GAAG,GAAG,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC,cAAc,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;QACxF,OAAO,cAAc,EAAE,MAAM,CAAC,qBAAqB,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;IACtF,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;IAE7B,IAAI,cAAc,IAAI,YAAY,IAAI,cAAc,CAAC,IAAI,CAAC,aAAa,EAAE;QACvE,OAAO,CACL,6BAAK,GAAG,EAAE,GAAG,EAAE,SAAS,EAAC,wBAAwB;YAC/C,oBAAC,eAAe,IAAC,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,CAAC,eAAe,EAAE,oBAAoB,EAAE,GAAG,EAAE;oBAClH,OAAO,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;gBACnD,CAAC,GAAI,CACD,CACP,CAAC;IAEJ,OAAO,CACL,oBAAC,YAAY;QAAC,6BAAK,SAAS,EAAC,kCAAkC,IAAE,gBAAgB,CAAO,CAAe,CACxG,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\nimport * as React from \"react\";\nimport { useActiveViewport } from \"@itwin/appui-react\";\nimport { FillCentered } from \"@itwin/core-react\";\nimport { MapLayerOptions } from \"../Interfaces\";\nimport { MapLayerManager } from \"./MapLayerManager\";\nimport { MapLayersUI } from \"../../mapLayers\";\n\n/**\n * Widget to Manage Map Layers\n * @beta\n */\ninterface MapLayersWidgetProps {\n mapLayerOptions?: MapLayerOptions;\n}\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function MapLayersWidget(props: MapLayersWidgetProps) {\n const [notGeoLocatedMsg] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.NotSupported\"));\n const activeViewport = useActiveViewport();\n const ref = React.useRef<HTMLDivElement>(null);\n const [isGeoLocated, setIsGeoLocated] = React.useState(!!activeViewport?.iModel.isGeoLocated);\n\n React.useEffect(() => {\n const updateIsGeoLocated = () => setIsGeoLocated(!!activeViewport?.iModel.isGeoLocated);\n return activeViewport?.iModel.onEcefLocationChanged.addListener(updateIsGeoLocated);\n }, [activeViewport?.iModel]);\n\n if (activeViewport && isGeoLocated && activeViewport.view.isSpatialView())\n return (\n <div ref={ref} className=\"map-manager-layer-host\">\n <MapLayerManager activeViewport={activeViewport} mapLayerOptions={props.mapLayerOptions} getContainerForClone={() => {\n return ref.current ? ref.current : document.body;\n }} />\n </div>\n );\n\n return (\n <FillCentered><div className=\"map-manager-not-geo-located-text\">{notGeoLocatedMsg}</div></FillCentered>\n );\n}\n"]}
1
+ {"version":3,"file":"MapLayersWidget.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayersWidget.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAS9C,gEAAg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":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport * as React from \"react\";\r\nimport { useActiveViewport } from \"@itwin/appui-react\";\r\nimport { FillCentered } from \"@itwin/core-react\";\r\nimport { MapLayerOptions } from \"../Interfaces\";\r\nimport { MapLayerManager } from \"./MapLayerManager\";\r\nimport { MapLayersUI } from \"../../mapLayers\";\r\n\r\n/**\r\n * Widget to Manage Map Layers\r\n * @beta\r\n */\r\ninterface MapLayersWidgetProps {\r\n mapLayerOptions?: MapLayerOptions;\r\n}\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function MapLayersWidget(props: MapLayersWidgetProps) {\r\n const [notGeoLocatedMsg] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.NotSupported\"));\r\n const activeViewport = useActiveViewport();\r\n const ref = React.useRef<HTMLDivElement>(null);\r\n const [isGeoLocated, setIsGeoLocated] = React.useState(!!activeViewport?.iModel.isGeoLocated);\r\n\r\n React.useEffect(() => {\r\n const updateIsGeoLocated = () => setIsGeoLocated(!!activeViewport?.iModel.isGeoLocated);\r\n return activeViewport?.iModel.onEcefLocationChanged.addListener(updateIsGeoLocated);\r\n }, [activeViewport?.iModel]);\r\n\r\n if (activeViewport && isGeoLocated && activeViewport.view.isSpatialView())\r\n return (\r\n <div ref={ref} className=\"map-manager-layer-host\">\r\n <MapLayerManager activeViewport={activeViewport} mapLayerOptions={props.mapLayerOptions} getContainerForClone={() => {\r\n return ref.current ? ref.current : document.body;\r\n }} />\r\n </div>\r\n );\r\n\r\n return (\r\n <FillCentered><div className=\"map-manager-not-geo-located-text\">{notGeoLocatedMsg}</div></FillCentered>\r\n );\r\n}\r\n"]}
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
2
- import "./MapManagerSettings.scss";
3
- export declare function MapManagerSettings(): JSX.Element;
1
+ /// <reference types="react" />
2
+ import "./MapManagerSettings.scss";
3
+ export declare function MapManagerSettings(): JSX.Element;
4
4
  //# sourceMappingURL=MapManagerSettings.d.ts.map