@itwin/map-layers 4.0.0-dev.7 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. package/CHANGELOG.md +746 -848
  2. package/README.md +32 -32
  3. package/lib/cjs/MapLayerPreferences.d.ts +88 -88
  4. package/lib/cjs/MapLayerPreferences.js +312 -312
  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 +34 -63
  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 +47 -52
  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.d.ts.map +1 -1
  21. package/lib/cjs/ui/MapFeatureInfoTool.js +50 -50
  22. package/lib/cjs/ui/MapFeatureInfoTool.js.map +1 -1
  23. package/lib/cjs/ui/MapLayersUiItemsProvider.d.ts +8 -8
  24. package/lib/cjs/ui/MapLayersUiItemsProvider.d.ts.map +1 -1
  25. package/lib/cjs/ui/MapLayersUiItemsProvider.js +35 -38
  26. package/lib/cjs/ui/MapLayersUiItemsProvider.js.map +1 -1
  27. package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts +13 -14
  28. package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
  29. package/lib/cjs/ui/widget/AttachLayerPopupButton.js +338 -338
  30. package/lib/cjs/ui/widget/AttachLayerPopupButton.js.map +1 -1
  31. package/lib/cjs/ui/widget/BasemapPanel.d.ts +7 -8
  32. package/lib/cjs/ui/widget/BasemapPanel.d.ts.map +1 -1
  33. package/lib/cjs/ui/widget/BasemapPanel.js +156 -156
  34. package/lib/cjs/ui/widget/BasemapPanel.js.map +1 -1
  35. package/lib/cjs/ui/widget/BasemapPanel.scss +87 -87
  36. package/lib/cjs/ui/widget/ConfirmMessageDialog.d.ts +20 -21
  37. package/lib/cjs/ui/widget/ConfirmMessageDialog.d.ts.map +1 -1
  38. package/lib/cjs/ui/widget/ConfirmMessageDialog.js +25 -25
  39. package/lib/cjs/ui/widget/ConfirmMessageDialog.js.map +1 -1
  40. package/lib/cjs/ui/widget/FeatureInfoDataProvider.d.ts +35 -40
  41. package/lib/cjs/ui/widget/FeatureInfoDataProvider.d.ts.map +1 -1
  42. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js +140 -139
  43. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  44. package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts +6 -7
  45. package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
  46. package/lib/cjs/ui/widget/FeatureInfoWidget.js +76 -71
  47. package/lib/cjs/ui/widget/FeatureInfoWidget.js.map +1 -1
  48. package/lib/cjs/ui/widget/MapLayerDroppable.d.ts +18 -19
  49. package/lib/cjs/ui/widget/MapLayerDroppable.d.ts.map +1 -1
  50. package/lib/cjs/ui/widget/MapLayerDroppable.js +88 -88
  51. package/lib/cjs/ui/widget/MapLayerDroppable.js.map +1 -1
  52. package/lib/cjs/ui/widget/MapLayerManager.d.ts +26 -26
  53. package/lib/cjs/ui/widget/MapLayerManager.js +403 -403
  54. package/lib/cjs/ui/widget/MapLayerManager.js.map +1 -1
  55. package/lib/cjs/ui/widget/MapLayerManager.scss +409 -409
  56. package/lib/cjs/ui/widget/MapLayerSettingsMenu.d.ts +11 -12
  57. package/lib/cjs/ui/widget/MapLayerSettingsMenu.d.ts.map +1 -1
  58. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js +83 -83
  59. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  60. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.d.ts +6 -7
  61. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.d.ts.map +1 -1
  62. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js +65 -65
  63. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  64. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.scss +20 -20
  65. package/lib/cjs/ui/widget/MapLayersWidget.d.ts +10 -11
  66. package/lib/cjs/ui/widget/MapLayersWidget.d.ts.map +1 -1
  67. package/lib/cjs/ui/widget/MapLayersWidget.js +31 -31
  68. package/lib/cjs/ui/widget/MapLayersWidget.js.map +1 -1
  69. package/lib/cjs/ui/widget/MapManagerSettings.d.ts +2 -3
  70. package/lib/cjs/ui/widget/MapManagerSettings.d.ts.map +1 -1
  71. package/lib/cjs/ui/widget/MapManagerSettings.js +200 -200
  72. package/lib/cjs/ui/widget/MapManagerSettings.js.map +1 -1
  73. package/lib/cjs/ui/widget/MapManagerSettings.scss +29 -29
  74. package/lib/cjs/ui/widget/MapUrlDialog.d.ts +22 -23
  75. package/lib/cjs/ui/widget/MapUrlDialog.d.ts.map +1 -1
  76. package/lib/cjs/ui/widget/MapUrlDialog.js +533 -527
  77. package/lib/cjs/ui/widget/MapUrlDialog.js.map +1 -1
  78. package/lib/cjs/ui/widget/MapUrlDialog.scss +99 -100
  79. package/lib/cjs/ui/widget/SelectMapFormat.d.ts +17 -18
  80. package/lib/cjs/ui/widget/SelectMapFormat.d.ts.map +1 -1
  81. package/lib/cjs/ui/widget/SelectMapFormat.js +59 -59
  82. package/lib/cjs/ui/widget/SelectMapFormat.js.map +1 -1
  83. package/lib/cjs/ui/widget/SubLayersDataProvider.d.ts +18 -20
  84. package/lib/cjs/ui/widget/SubLayersDataProvider.d.ts.map +1 -1
  85. package/lib/cjs/ui/widget/SubLayersDataProvider.js +75 -76
  86. package/lib/cjs/ui/widget/SubLayersDataProvider.js.map +1 -1
  87. package/lib/cjs/ui/widget/SubLayersPopupButton.d.ts +9 -10
  88. package/lib/cjs/ui/widget/SubLayersPopupButton.d.ts.map +1 -1
  89. package/lib/cjs/ui/widget/SubLayersPopupButton.js +40 -40
  90. package/lib/cjs/ui/widget/SubLayersPopupButton.js.map +1 -1
  91. package/lib/cjs/ui/widget/SubLayersTree.d.ts +14 -15
  92. package/lib/cjs/ui/widget/SubLayersTree.d.ts.map +1 -1
  93. package/lib/cjs/ui/widget/SubLayersTree.js +419 -419
  94. package/lib/cjs/ui/widget/SubLayersTree.js.map +1 -1
  95. package/lib/cjs/ui/widget/SubLayersTree.scss +70 -69
  96. package/lib/cjs/ui/widget/TransparencyPopupButton.d.ts +13 -14
  97. package/lib/cjs/ui/widget/TransparencyPopupButton.d.ts.map +1 -1
  98. package/lib/cjs/ui/widget/TransparencyPopupButton.js +47 -47
  99. package/lib/cjs/ui/widget/TransparencyPopupButton.js.map +1 -1
  100. package/lib/cjs/ui/widget/TransparencyPopupButton.scss +35 -36
  101. package/lib/esm/MapLayerPreferences.d.ts +88 -88
  102. package/lib/esm/MapLayerPreferences.js +308 -308
  103. package/lib/esm/MapLayerPreferences.js.map +1 -1
  104. package/lib/esm/map-layers.d.ts +6 -6
  105. package/lib/esm/map-layers.js +10 -10
  106. package/lib/esm/mapLayers.d.ts +26 -44
  107. package/lib/esm/mapLayers.d.ts.map +1 -1
  108. package/lib/esm/mapLayers.js +30 -59
  109. package/lib/esm/mapLayers.js.map +1 -1
  110. package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts +16 -11
  111. package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts.map +1 -1
  112. package/lib/esm/ui/FeatureInfoUiItemsProvider.js +43 -48
  113. package/lib/esm/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  114. package/lib/esm/ui/Interfaces.d.ts +50 -50
  115. package/lib/esm/ui/Interfaces.js +1 -1
  116. package/lib/esm/ui/Interfaces.js.map +1 -1
  117. package/lib/esm/ui/MapFeatureInfoTool.d.ts +13 -13
  118. package/lib/esm/ui/MapFeatureInfoTool.d.ts.map +1 -1
  119. package/lib/esm/ui/MapFeatureInfoTool.js +45 -45
  120. package/lib/esm/ui/MapFeatureInfoTool.js.map +1 -1
  121. package/lib/esm/ui/MapLayersUiItemsProvider.d.ts +8 -8
  122. package/lib/esm/ui/MapLayersUiItemsProvider.d.ts.map +1 -1
  123. package/lib/esm/ui/MapLayersUiItemsProvider.js +31 -34
  124. package/lib/esm/ui/MapLayersUiItemsProvider.js.map +1 -1
  125. package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts +13 -14
  126. package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
  127. package/lib/esm/ui/widget/AttachLayerPopupButton.js +334 -334
  128. package/lib/esm/ui/widget/AttachLayerPopupButton.js.map +1 -1
  129. package/lib/esm/ui/widget/BasemapPanel.d.ts +7 -8
  130. package/lib/esm/ui/widget/BasemapPanel.d.ts.map +1 -1
  131. package/lib/esm/ui/widget/BasemapPanel.js +152 -152
  132. package/lib/esm/ui/widget/BasemapPanel.js.map +1 -1
  133. package/lib/esm/ui/widget/BasemapPanel.scss +87 -87
  134. package/lib/esm/ui/widget/ConfirmMessageDialog.d.ts +20 -21
  135. package/lib/esm/ui/widget/ConfirmMessageDialog.d.ts.map +1 -1
  136. package/lib/esm/ui/widget/ConfirmMessageDialog.js +21 -21
  137. package/lib/esm/ui/widget/ConfirmMessageDialog.js.map +1 -1
  138. package/lib/esm/ui/widget/FeatureInfoDataProvider.d.ts +35 -40
  139. package/lib/esm/ui/widget/FeatureInfoDataProvider.d.ts.map +1 -1
  140. package/lib/esm/ui/widget/FeatureInfoDataProvider.js +136 -135
  141. package/lib/esm/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  142. package/lib/esm/ui/widget/FeatureInfoWidget.d.ts +6 -7
  143. package/lib/esm/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
  144. package/lib/esm/ui/widget/FeatureInfoWidget.js +72 -67
  145. package/lib/esm/ui/widget/FeatureInfoWidget.js.map +1 -1
  146. package/lib/esm/ui/widget/MapLayerDroppable.d.ts +18 -19
  147. package/lib/esm/ui/widget/MapLayerDroppable.d.ts.map +1 -1
  148. package/lib/esm/ui/widget/MapLayerDroppable.js +84 -84
  149. package/lib/esm/ui/widget/MapLayerDroppable.js.map +1 -1
  150. package/lib/esm/ui/widget/MapLayerManager.d.ts +26 -26
  151. package/lib/esm/ui/widget/MapLayerManager.js +398 -398
  152. package/lib/esm/ui/widget/MapLayerManager.js.map +1 -1
  153. package/lib/esm/ui/widget/MapLayerManager.scss +409 -409
  154. package/lib/esm/ui/widget/MapLayerSettingsMenu.d.ts +11 -12
  155. package/lib/esm/ui/widget/MapLayerSettingsMenu.d.ts.map +1 -1
  156. package/lib/esm/ui/widget/MapLayerSettingsMenu.js +79 -79
  157. package/lib/esm/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  158. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.d.ts +6 -7
  159. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.d.ts.map +1 -1
  160. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js +61 -61
  161. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  162. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.scss +20 -20
  163. package/lib/esm/ui/widget/MapLayersWidget.d.ts +10 -11
  164. package/lib/esm/ui/widget/MapLayersWidget.d.ts.map +1 -1
  165. package/lib/esm/ui/widget/MapLayersWidget.js +27 -27
  166. package/lib/esm/ui/widget/MapLayersWidget.js.map +1 -1
  167. package/lib/esm/ui/widget/MapManagerSettings.d.ts +2 -3
  168. package/lib/esm/ui/widget/MapManagerSettings.d.ts.map +1 -1
  169. package/lib/esm/ui/widget/MapManagerSettings.js +196 -196
  170. package/lib/esm/ui/widget/MapManagerSettings.js.map +1 -1
  171. package/lib/esm/ui/widget/MapManagerSettings.scss +29 -29
  172. package/lib/esm/ui/widget/MapUrlDialog.d.ts +22 -23
  173. package/lib/esm/ui/widget/MapUrlDialog.d.ts.map +1 -1
  174. package/lib/esm/ui/widget/MapUrlDialog.js +529 -523
  175. package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
  176. package/lib/esm/ui/widget/MapUrlDialog.scss +99 -100
  177. package/lib/esm/ui/widget/SelectMapFormat.d.ts +17 -18
  178. package/lib/esm/ui/widget/SelectMapFormat.d.ts.map +1 -1
  179. package/lib/esm/ui/widget/SelectMapFormat.js +55 -55
  180. package/lib/esm/ui/widget/SelectMapFormat.js.map +1 -1
  181. package/lib/esm/ui/widget/SubLayersDataProvider.d.ts +18 -20
  182. package/lib/esm/ui/widget/SubLayersDataProvider.d.ts.map +1 -1
  183. package/lib/esm/ui/widget/SubLayersDataProvider.js +71 -72
  184. package/lib/esm/ui/widget/SubLayersDataProvider.js.map +1 -1
  185. package/lib/esm/ui/widget/SubLayersPopupButton.d.ts +9 -10
  186. package/lib/esm/ui/widget/SubLayersPopupButton.d.ts.map +1 -1
  187. package/lib/esm/ui/widget/SubLayersPopupButton.js +36 -36
  188. package/lib/esm/ui/widget/SubLayersPopupButton.js.map +1 -1
  189. package/lib/esm/ui/widget/SubLayersTree.d.ts +14 -15
  190. package/lib/esm/ui/widget/SubLayersTree.d.ts.map +1 -1
  191. package/lib/esm/ui/widget/SubLayersTree.js +414 -414
  192. package/lib/esm/ui/widget/SubLayersTree.js.map +1 -1
  193. package/lib/esm/ui/widget/SubLayersTree.scss +70 -69
  194. package/lib/esm/ui/widget/TransparencyPopupButton.d.ts +13 -14
  195. package/lib/esm/ui/widget/TransparencyPopupButton.d.ts.map +1 -1
  196. package/lib/esm/ui/widget/TransparencyPopupButton.js +43 -43
  197. package/lib/esm/ui/widget/TransparencyPopupButton.js.map +1 -1
  198. package/lib/esm/ui/widget/TransparencyPopupButton.scss +35 -36
  199. package/package.json +39 -38
@@ -1,13 +1,12 @@
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
+ import { ScreenViewport } from "@itwin/core-frontend";
2
+ import "./MapLayerManager.scss";
3
+ import { StyleMapLayerSettings } from "../Interfaces";
4
+ interface MapLayerSettingsMenuProps {
5
+ mapLayerSettings: StyleMapLayerSettings;
6
+ onMenuItemSelection: (action: string, mapLayerSettings: StyleMapLayerSettings) => void;
7
+ activeViewport: ScreenViewport;
8
+ disabled?: boolean;
9
+ }
10
+ export declare function MapLayerSettingsMenu({ mapLayerSettings, onMenuItemSelection, activeViewport, disabled }: MapLayerSettingsMenuProps): JSX.Element;
11
+ export {};
13
12
  //# sourceMappingURL=MapLayerSettingsMenu.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MapLayerSettingsMenu.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerSettingsMenu.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD,OAAO,wBAAwB,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAGtD,UAAU,yBAAyB;IACjC,gBAAgB,EAAE,qBAAqB,CAAC;IACxC,mBAAmB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACvF,cAAc,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAGD,wBAAgB,oBAAoB,CAAC,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,yBAAyB,eAkFlI"}
1
+ {"version":3,"file":"MapLayerSettingsMenu.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerSettingsMenu.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD,OAAO,wBAAwB,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAGtD,UAAU,yBAAyB;IACjC,gBAAgB,EAAE,qBAAqB,CAAC;IACxC,mBAAmB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACvF,cAAc,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAGD,wBAAgB,oBAAoB,CAAC,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,yBAAyB,eAkFlI"}
@@ -1,84 +1,84 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MapLayerSettingsMenu = void 0;
4
- /*---------------------------------------------------------------------------------------------
5
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
- * See LICENSE.md in the project root for license terms and full copyright notice.
7
- *--------------------------------------------------------------------------------------------*/
8
- const React = require("react");
9
- const core_react_1 = require("@itwin/core-react");
10
- const itwinui_react_1 = require("@itwin/itwinui-react");
11
- require("./MapLayerManager.scss");
12
- const mapLayers_1 = require("../../mapLayers");
13
- // eslint-disable-next-line @typescript-eslint/naming-convention
14
- function MapLayerSettingsMenu({ mapLayerSettings, onMenuItemSelection, activeViewport, disabled }) {
15
- const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);
16
- const settingsRef = React.useRef(null);
17
- const [labelDetach] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:LayerMenu.Detach"));
18
- const [labelZoomToLayer] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:LayerMenu.ZoomToLayer"));
19
- const [hasRangeData, setHasRangeData] = React.useState();
20
- const [transparency, setTransparency] = React.useState(mapLayerSettings.transparency);
21
- React.useEffect(() => {
22
- async function fetchRangeData() {
23
- let hasRange = false;
24
- const indexInDisplayStyle = activeViewport === null || activeViewport === void 0 ? void 0 : activeViewport.displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);
25
- if (undefined !== indexInDisplayStyle) {
26
- hasRange = (undefined !== await activeViewport.displayStyle.getMapLayerRange(indexInDisplayStyle, mapLayerSettings.isOverlay));
27
- }
28
- setHasRangeData(hasRange);
29
- }
30
- fetchRangeData(); // eslint-disable-line @typescript-eslint/no-floating-promises
31
- }, [activeViewport, mapLayerSettings]);
32
- const onSettingsClick = React.useCallback(() => {
33
- setIsSettingsOpen((prev) => !prev);
34
- }, [setIsSettingsOpen]);
35
- const handleCloseSetting = React.useCallback(() => {
36
- setIsSettingsOpen(false);
37
- }, [setIsSettingsOpen]);
38
- const handleRemoveLayer = React.useCallback(() => {
39
- setIsSettingsOpen(false);
40
- onMenuItemSelection("delete", mapLayerSettings);
41
- }, [setIsSettingsOpen, onMenuItemSelection, mapLayerSettings]);
42
- const handleZoomToLayer = React.useCallback(() => {
43
- setIsSettingsOpen(false);
44
- onMenuItemSelection("zoom-to-layer", mapLayerSettings);
45
- }, [setIsSettingsOpen, onMenuItemSelection, mapLayerSettings]);
46
- const applyTransparencyChange = React.useCallback((value) => {
47
- var _a;
48
- if (activeViewport) {
49
- const newTransparency = value;
50
- const displayStyle = activeViewport.displayStyle;
51
- const indexInDisplayStyle = displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);
52
- if (-1 !== indexInDisplayStyle) {
53
- const styleTransparency = (_a = displayStyle.mapLayerAtIndex(indexInDisplayStyle, mapLayerSettings.isOverlay)) === null || _a === void 0 ? void 0 : _a.transparency;
54
- const styleTransparencyValue = styleTransparency ? styleTransparency : 0;
55
- if (Math.abs(styleTransparencyValue - newTransparency) > 0.01) {
56
- // update the display style
57
- displayStyle.changeMapLayerProps({ transparency: newTransparency }, indexInDisplayStyle, mapLayerSettings.isOverlay);
58
- activeViewport.invalidateRenderPlan();
59
- // force UI to update
60
- // loadMapLayerSettingsFromStyle(activeViewport.displayStyle);
61
- }
62
- }
63
- }
64
- }, [activeViewport, mapLayerSettings]);
65
- const handleTransparencyChange = React.useCallback((values) => {
66
- if (values.length) {
67
- const newTransparency = values[0] / 100.0;
68
- if (newTransparency !== transparency) {
69
- setTransparency(newTransparency);
70
- applyTransparencyChange(newTransparency);
71
- }
72
- }
73
- }, [transparency, applyTransparencyChange]);
74
- return (React.createElement(React.Fragment, null,
75
- React.createElement(itwinui_react_1.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 }),
76
- React.createElement(core_react_1.ContextMenu, { opened: isSettingsOpen && (undefined !== hasRangeData), onOutsideClick: handleCloseSetting },
77
- React.createElement("div", { className: "map-manager-item-menu" },
78
- React.createElement(core_react_1.ContextMenuItem, { hideIconContainer: true, key: 0, className: hasRangeData ? "" : "core-context-menu-disabled", onSelect: handleZoomToLayer }, labelZoomToLayer),
79
- React.createElement(core_react_1.ContextMenuItem, { hideIconContainer: true, key: 1, onSelect: handleRemoveLayer }, labelDetach),
80
- React.createElement(core_react_1.ContextMenuItem, { hideIconContainer: true, key: 2 },
81
- React.createElement(itwinui_react_1.Slider, { min: 0, max: 100, values: [transparency * 100], step: 1, onChange: handleTransparencyChange }))))));
82
- }
83
- exports.MapLayerSettingsMenu = MapLayerSettingsMenu;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MapLayerSettingsMenu = void 0;
4
+ /*---------------------------------------------------------------------------------------------
5
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
+ * See LICENSE.md in the project root for license terms and full copyright notice.
7
+ *--------------------------------------------------------------------------------------------*/
8
+ const React = require("react");
9
+ const core_react_1 = require("@itwin/core-react");
10
+ const itwinui_react_1 = require("@itwin/itwinui-react");
11
+ require("./MapLayerManager.scss");
12
+ const mapLayers_1 = require("../../mapLayers");
13
+ // eslint-disable-next-line @typescript-eslint/naming-convention
14
+ function MapLayerSettingsMenu({ mapLayerSettings, onMenuItemSelection, activeViewport, disabled }) {
15
+ const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);
16
+ const settingsRef = React.useRef(null);
17
+ const [labelDetach] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:LayerMenu.Detach"));
18
+ const [labelZoomToLayer] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:LayerMenu.ZoomToLayer"));
19
+ const [hasRangeData, setHasRangeData] = React.useState();
20
+ const [transparency, setTransparency] = React.useState(mapLayerSettings.transparency);
21
+ React.useEffect(() => {
22
+ async function fetchRangeData() {
23
+ let hasRange = false;
24
+ const indexInDisplayStyle = activeViewport === null || activeViewport === void 0 ? void 0 : activeViewport.displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);
25
+ if (undefined !== indexInDisplayStyle) {
26
+ hasRange = (undefined !== await activeViewport.displayStyle.getMapLayerRange(indexInDisplayStyle, mapLayerSettings.isOverlay));
27
+ }
28
+ setHasRangeData(hasRange);
29
+ }
30
+ fetchRangeData(); // eslint-disable-line @typescript-eslint/no-floating-promises
31
+ }, [activeViewport, mapLayerSettings]);
32
+ const onSettingsClick = React.useCallback(() => {
33
+ setIsSettingsOpen((prev) => !prev);
34
+ }, [setIsSettingsOpen]);
35
+ const handleCloseSetting = React.useCallback(() => {
36
+ setIsSettingsOpen(false);
37
+ }, [setIsSettingsOpen]);
38
+ const handleRemoveLayer = React.useCallback(() => {
39
+ setIsSettingsOpen(false);
40
+ onMenuItemSelection("delete", mapLayerSettings);
41
+ }, [setIsSettingsOpen, onMenuItemSelection, mapLayerSettings]);
42
+ const handleZoomToLayer = React.useCallback(() => {
43
+ setIsSettingsOpen(false);
44
+ onMenuItemSelection("zoom-to-layer", mapLayerSettings);
45
+ }, [setIsSettingsOpen, onMenuItemSelection, mapLayerSettings]);
46
+ const applyTransparencyChange = React.useCallback((value) => {
47
+ var _a;
48
+ if (activeViewport) {
49
+ const newTransparency = value;
50
+ const displayStyle = activeViewport.displayStyle;
51
+ const indexInDisplayStyle = displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);
52
+ if (-1 !== indexInDisplayStyle) {
53
+ const styleTransparency = (_a = displayStyle.mapLayerAtIndex(indexInDisplayStyle, mapLayerSettings.isOverlay)) === null || _a === void 0 ? void 0 : _a.transparency;
54
+ const styleTransparencyValue = styleTransparency ? styleTransparency : 0;
55
+ if (Math.abs(styleTransparencyValue - newTransparency) > 0.01) {
56
+ // update the display style
57
+ displayStyle.changeMapLayerProps({ transparency: newTransparency }, indexInDisplayStyle, mapLayerSettings.isOverlay);
58
+ activeViewport.invalidateRenderPlan();
59
+ // force UI to update
60
+ // loadMapLayerSettingsFromStyle(activeViewport.displayStyle);
61
+ }
62
+ }
63
+ }
64
+ }, [activeViewport, mapLayerSettings]);
65
+ const handleTransparencyChange = React.useCallback((values) => {
66
+ if (values.length) {
67
+ const newTransparency = values[0] / 100.0;
68
+ if (newTransparency !== transparency) {
69
+ setTransparency(newTransparency);
70
+ applyTransparencyChange(newTransparency);
71
+ }
72
+ }
73
+ }, [transparency, applyTransparencyChange]);
74
+ return (React.createElement(React.Fragment, null,
75
+ React.createElement(itwinui_react_1.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 }),
76
+ React.createElement(core_react_1.ContextMenu, { opened: isSettingsOpen && (undefined !== hasRangeData), onOutsideClick: handleCloseSetting },
77
+ React.createElement("div", { className: "map-manager-item-menu" },
78
+ React.createElement(core_react_1.ContextMenuItem, { hideIconContainer: true, key: 0, className: hasRangeData ? "" : "core-context-menu-disabled", onSelect: handleZoomToLayer }, labelZoomToLayer),
79
+ React.createElement(core_react_1.ContextMenuItem, { hideIconContainer: true, key: 1, onSelect: handleRemoveLayer }, labelDetach),
80
+ React.createElement(core_react_1.ContextMenuItem, { hideIconContainer: true, key: 2 },
81
+ React.createElement(itwinui_react_1.Slider, { min: 0, max: 100, values: [transparency * 100], step: 1, onChange: handleTransparencyChange }))))));
82
+ }
83
+ exports.MapLayerSettingsMenu = MapLayerSettingsMenu;
84
84
  //# 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,+BAA+B;AAE/B,kDAAiE;AACjE,wDAAsD;AACtD,kCAAgC;AAEhC,+CAA8C;AAS9C,gEAAgE;AAChE,SAAgB,oBAAoB,CAAC,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,cAAc,EAAE,QAAQ,EAA6B;IACjI,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClE,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAoB,IAAI,CAAC,CAAC;IAC1D,MAAM,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,uBAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,4BAA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AC,EAAE,QAAQ,EAAE,iBAAiB,IAAG,WAAW,CAAmB;gBAC9G,oBAAC,4BAAe,IAAC,iBAAiB,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;oBAC9C,oBAAC,sBAAM,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;AAlFD,oDAkFC","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
+ {"version":3,"file":"MapLayerSettingsMenu.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerSettingsMenu.tsx"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,+BAA+B;AAE/B,kDAAiE;AACjE,wDAAsD;AACtD,kCAAgC;AAEhC,+CAA8C;AAS9C,gEAAgE;AAChE,SAAgB,oBAAoB,CAAC,E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AC,EAAE,cAAc,EAAE,kBAAkB;YACrG,6BAAK,SAAS,EAAC,uBAAuB;gBACpC,oBAAC,4BAAe,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,4BAAe,IAAC,iBAAiB,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,QAAQ,EAAE,iBAAiB,IAAG,WAAW,CAAmB;gBAC9G,oBAAC,4BAAe,IAAC,iBAAiB,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;oBAC9C,oBAAC,sBAAM,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;AAlFD,oDAkFC","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,8 +1,7 @@
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
+ import "./MapLayerSettingsPopupButton.scss";
2
+ export interface MapLayerSettingsPopupButtonProps {
3
+ disabled?: boolean;
4
+ }
5
+ /** @alpha */
6
+ export declare function MapLayerSettingsPopupButton(props: MapLayerSettingsPopupButtonProps): JSX.Element;
8
7
  //# sourceMappingURL=MapLayerSettingsPopupButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MapLayerSettingsPopupButton.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerSettingsPopupButton.tsx"],"names":[],"mappings":";AAUA,OAAO,oCAAoC,CAAC;AAG5C,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,aAAa;AAEb,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,gCAAgC,eAoElF"}
1
+ {"version":3,"file":"MapLayerSettingsPopupButton.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerSettingsPopupButton.tsx"],"names":[],"mappings":"AAUA,OAAO,oCAAoC,CAAC;AAG5C,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,aAAa;AAEb,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,gCAAgC,eAoElF"}
@@ -1,66 +1,66 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.MapLayerSettingsPopupButton = void 0;
8
- const React = require("react");
9
- const appui_abstract_1 = require("@itwin/appui-abstract");
10
- const core_react_1 = require("@itwin/core-react");
11
- const MapManagerSettings_1 = require("./MapManagerSettings");
12
- require("./MapLayerSettingsPopupButton.scss");
13
- const mapLayers_1 = require("../../mapLayers");
14
- const itwinui_react_1 = require("@itwin/itwinui-react");
15
- /** @alpha */
16
- // eslint-disable-next-line @typescript-eslint/naming-convention
17
- function MapLayerSettingsPopupButton(props) {
18
- const panelRef = React.useRef(null);
19
- const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);
20
- const [buttonTooltip] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Widget.SettingsButtonTooltip"));
21
- const buttonRef = React.useRef(null);
22
- const togglePopupDisplay = React.useCallback((event) => {
23
- event.preventDefault();
24
- setIsSettingsOpen((prev) => !prev);
25
- }, [setIsSettingsOpen]);
26
- const handleCloseSetting = React.useCallback(() => {
27
- setIsSettingsOpen(false);
28
- }, [setIsSettingsOpen]);
29
- const isInsideCoreDialog = React.useCallback((element) => {
30
- if (element.nodeName === "DIV") {
31
- if (element.classList && element.classList.contains("core-dialog"))
32
- return true;
33
- if (element.parentElement && isInsideCoreDialog(element.parentElement))
34
- return true;
35
- }
36
- else {
37
- // istanbul ignore else
38
- if (element.parentElement && isInsideCoreDialog(element.parentElement))
39
- return true;
40
- }
41
- return false;
42
- }, []);
43
- const handleOutsideClick = React.useCallback((event) => {
44
- if (isInsideCoreDialog(event.target)) {
45
- return;
46
- }
47
- // If clicking on button that open panel - don't trigger outside click processing
48
- if ((buttonRef === null || buttonRef === void 0 ? void 0 : buttonRef.current) && (buttonRef === null || buttonRef === void 0 ? void 0 : buttonRef.current.contains(event.target))) {
49
- return;
50
- }
51
- // If clicking the panel, this is not an outside clicked
52
- if (panelRef.current && (panelRef === null || panelRef === void 0 ? void 0 : panelRef.current.contains(event.target))) {
53
- return;
54
- }
55
- // If we reach this point, we got an outside clicked, no close the popup
56
- setIsSettingsOpen(false);
57
- }, [isInsideCoreDialog]);
58
- return (React.createElement(React.Fragment, null,
59
- React.createElement(itwinui_react_1.Button, { disabled: props.disabled, styleType: "borderless", title: buttonTooltip, className: "maplayers-settings-popup-button", onClick: togglePopupDisplay, ref: buttonRef },
60
- React.createElement(core_react_1.WebFontIcon, { iconName: "icon-settings" })),
61
- React.createElement(core_react_1.Popup, { isOpen: isSettingsOpen, position: appui_abstract_1.RelativePosition.BottomRight, onClose: handleCloseSetting, target: buttonRef.current, onOutsideClick: handleOutsideClick, repositionOnResize: true },
62
- React.createElement("div", { ref: panelRef, className: "maplayers-settings-popup-panel" },
63
- React.createElement(MapManagerSettings_1.MapManagerSettings, null)))));
64
- }
65
- exports.MapLayerSettingsPopupButton = MapLayerSettingsPopupButton;
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.MapLayerSettingsPopupButton = void 0;
8
+ const React = require("react");
9
+ const appui_abstract_1 = require("@itwin/appui-abstract");
10
+ const core_react_1 = require("@itwin/core-react");
11
+ const MapManagerSettings_1 = require("./MapManagerSettings");
12
+ require("./MapLayerSettingsPopupButton.scss");
13
+ const mapLayers_1 = require("../../mapLayers");
14
+ const itwinui_react_1 = require("@itwin/itwinui-react");
15
+ /** @alpha */
16
+ // eslint-disable-next-line @typescript-eslint/naming-convention
17
+ function MapLayerSettingsPopupButton(props) {
18
+ const panelRef = React.useRef(null);
19
+ const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);
20
+ const [buttonTooltip] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Widget.SettingsButtonTooltip"));
21
+ const buttonRef = React.useRef(null);
22
+ const togglePopupDisplay = React.useCallback((event) => {
23
+ event.preventDefault();
24
+ setIsSettingsOpen((prev) => !prev);
25
+ }, [setIsSettingsOpen]);
26
+ const handleCloseSetting = React.useCallback(() => {
27
+ setIsSettingsOpen(false);
28
+ }, [setIsSettingsOpen]);
29
+ const isInsideCoreDialog = React.useCallback((element) => {
30
+ if (element.nodeName === "DIV") {
31
+ if (element.classList && element.classList.contains("core-dialog"))
32
+ return true;
33
+ if (element.parentElement && isInsideCoreDialog(element.parentElement))
34
+ return true;
35
+ }
36
+ else {
37
+ // istanbul ignore else
38
+ if (element.parentElement && isInsideCoreDialog(element.parentElement))
39
+ return true;
40
+ }
41
+ return false;
42
+ }, []);
43
+ const handleOutsideClick = React.useCallback((event) => {
44
+ if (isInsideCoreDialog(event.target)) {
45
+ return;
46
+ }
47
+ // If clicking on button that open panel - don't trigger outside click processing
48
+ if ((buttonRef === null || buttonRef === void 0 ? void 0 : buttonRef.current) && (buttonRef === null || buttonRef === void 0 ? void 0 : buttonRef.current.contains(event.target))) {
49
+ return;
50
+ }
51
+ // If clicking the panel, this is not an outside clicked
52
+ if (panelRef.current && (panelRef === null || panelRef === void 0 ? void 0 : panelRef.current.contains(event.target))) {
53
+ return;
54
+ }
55
+ // If we reach this point, we got an outside clicked, no close the popup
56
+ setIsSettingsOpen(false);
57
+ }, [isInsideCoreDialog]);
58
+ return (React.createElement(React.Fragment, null,
59
+ React.createElement(itwinui_react_1.Button, { disabled: props.disabled, styleType: "borderless", title: buttonTooltip, className: "maplayers-settings-popup-button", onClick: togglePopupDisplay, ref: buttonRef },
60
+ React.createElement(core_react_1.WebFontIcon, { iconName: "icon-settings" })),
61
+ React.createElement(core_react_1.Popup, { isOpen: isSettingsOpen, position: appui_abstract_1.RelativePosition.BottomRight, onClose: handleCloseSetting, target: buttonRef.current, onOutsideClick: handleOutsideClick, repositionOnResize: true },
62
+ React.createElement("div", { ref: panelRef, className: "maplayers-settings-popup-panel" },
63
+ React.createElement(MapManagerSettings_1.MapManagerSettings, null)))));
64
+ }
65
+ exports.MapLayerSettingsPopupButton = MapLayerSettingsPopupButton;
66
66
  //# 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,+BAA+B;AAC/B,0DAAyD;A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,kBAAkB,EAAE,IAAI;YAExB,6BAAK,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,gCAAgC;gBAC5D,oBAAC,uCAAkB,OAAG,CAClB,CACC,CACP,CACL,CAAC;AACJ,CAAC;AApED,kEAoEC","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
+ {"version":3,"file":"MapLayerSettingsPopupButton.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerSettingsPopupButton.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,+BAA+B;AAC/B,0DAAyD;AACzD,kDAAuD;AACvD,6DAA0D;AAE1D,8CAA4C;AAC5C,+CAA8C;AAC9C,wDAA8C;AAK9C,aAAa;AACb,gEAAgE;AAChE,SAAgB,2BAA2B,CAAC,KAAuC;IACjF,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAiB,IAAI,CAAC,CAAC;IACpD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AC,WAAW,CAAC,CAAC,KAAiB,EAAE,EAAE;QACjE,IAAI,kBAAkB,CAAC,KAAK,CAAC,MAAqB,CAAC,EAAE;YACnD,OAAO;SACR;QAED,kFAAkF;QAClF,IAAI,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,OAAO,MAAI,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAc,CAAC,CAAA,EAAE;YAC3E,OAAO;SACR;QAED,wDAAwD;QACxD,IAAI,QAAQ,CAAC,OAAO,KAAI,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAc,CAAC,CAAA,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,sBAAM,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,wBAAW,IAAC,QAAQ,EAAC,eAAe,GAAG,CACjC;QACT,oBAAC,kBAAK,IACJ,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,iCAAgB,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,uCAAkB,OAAG,CAClB,CACC,CACP,CACL,CAAC;AACJ,CAAC;AApED,kEAoEC","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,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,11 @@
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
+ import { MapLayerOptions } from "../Interfaces";
2
+ /**
3
+ * Widget to Manage Map Layers
4
+ * @beta
5
+ */
6
+ interface MapLayersWidgetProps {
7
+ mapLayerOptions?: MapLayerOptions;
8
+ }
9
+ export declare function MapLayersWidget(props: MapLayersWidgetProps): JSX.Element;
10
+ export {};
12
11
  //# sourceMappingURL=MapLayersWidget.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MapLayersWidget.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayersWidget.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAIhD;;;GAGG;AACH,UAAU,oBAAoB;IAC5B,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,eAuB1D"}
1
+ {"version":3,"file":"MapLayersWidget.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayersWidget.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAIhD;;;GAGG;AACH,UAAU,oBAAoB;IAC5B,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,eAuB1D"}
@@ -1,32 +1,32 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.MapLayersWidget = void 0;
8
- const React = require("react");
9
- const appui_react_1 = require("@itwin/appui-react");
10
- const core_react_1 = require("@itwin/core-react");
11
- const MapLayerManager_1 = require("./MapLayerManager");
12
- const mapLayers_1 = require("../../mapLayers");
13
- // eslint-disable-next-line @typescript-eslint/naming-convention
14
- function MapLayersWidget(props) {
15
- const [notGeoLocatedMsg] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.NotSupported"));
16
- const activeViewport = (0, appui_react_1.useActiveViewport)();
17
- const ref = React.useRef(null);
18
- const [isGeoLocated, setIsGeoLocated] = React.useState(!!(activeViewport === null || activeViewport === void 0 ? void 0 : activeViewport.iModel.isGeoLocated));
19
- React.useEffect(() => {
20
- const updateIsGeoLocated = () => setIsGeoLocated(!!(activeViewport === null || activeViewport === void 0 ? void 0 : activeViewport.iModel.isGeoLocated));
21
- return activeViewport === null || activeViewport === void 0 ? void 0 : activeViewport.iModel.onEcefLocationChanged.addListener(updateIsGeoLocated);
22
- }, [activeViewport === null || activeViewport === void 0 ? void 0 : activeViewport.iModel]);
23
- if (activeViewport && isGeoLocated && activeViewport.view.isSpatialView())
24
- return (React.createElement("div", { ref: ref, className: "map-manager-layer-host" },
25
- React.createElement(MapLayerManager_1.MapLayerManager, { activeViewport: activeViewport, mapLayerOptions: props.mapLayerOptions, getContainerForClone: () => {
26
- return ref.current ? ref.current : document.body;
27
- } })));
28
- return (React.createElement(core_react_1.FillCentered, null,
29
- React.createElement("div", { className: "map-manager-not-geo-located-text" }, notGeoLocatedMsg)));
30
- }
31
- exports.MapLayersWidget = MapLayersWidget;
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.MapLayersWidget = void 0;
8
+ const React = require("react");
9
+ const appui_react_1 = require("@itwin/appui-react");
10
+ const core_react_1 = require("@itwin/core-react");
11
+ const MapLayerManager_1 = require("./MapLayerManager");
12
+ const mapLayers_1 = require("../../mapLayers");
13
+ // eslint-disable-next-line @typescript-eslint/naming-convention
14
+ function MapLayersWidget(props) {
15
+ const [notGeoLocatedMsg] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.NotSupported"));
16
+ const activeViewport = (0, appui_react_1.useActiveViewport)();
17
+ const ref = React.useRef(null);
18
+ const [isGeoLocated, setIsGeoLocated] = React.useState(!!(activeViewport === null || activeViewport === void 0 ? void 0 : activeViewport.iModel.isGeoLocated));
19
+ React.useEffect(() => {
20
+ const updateIsGeoLocated = () => setIsGeoLocated(!!(activeViewport === null || activeViewport === void 0 ? void 0 : activeViewport.iModel.isGeoLocated));
21
+ return activeViewport === null || activeViewport === void 0 ? void 0 : activeViewport.iModel.onEcefLocationChanged.addListener(updateIsGeoLocated);
22
+ }, [activeViewport === null || activeViewport === void 0 ? void 0 : activeViewport.iModel]);
23
+ if (activeViewport && isGeoLocated && activeViewport.view.isSpatialView())
24
+ return (React.createElement("div", { ref: ref, className: "map-manager-layer-host" },
25
+ React.createElement(MapLayerManager_1.MapLayerManager, { activeViewport: activeViewport, mapLayerOptions: props.mapLayerOptions, getContainerForClone: () => {
26
+ return ref.current ? ref.current : document.body;
27
+ } })));
28
+ return (React.createElement(core_react_1.FillCentered, null,
29
+ React.createElement("div", { className: "map-manager-not-geo-located-text" }, notGeoLocatedMsg)));
30
+ }
31
+ exports.MapLayersWidget = MapLayersWidget;
32
32
  //# 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,+BAA+B;AAC/B,oDAAuD;AACvD,kDAAiD;AAEjD,uDAAoD;AACpD,+CAA8C;AAS9C,gEAAgE;AAChE,SAAgB,eAAe,CAAC,KAA2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BAAY;QAAC,6BAAK,SAAS,EAAC,kCAAkC,IAAE,gBAAgB,CAAO,CAAe,CACxG,CAAC;AACJ,CAAC;AAvBD,0CAuBC","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 { 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 );\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AAc,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,yBAAY;QAAC,6BAAK,SAAS,EAAC,kCAAkC,IAAE,gBAAgB,CAAO,CAAe,CACxG,CAAC;AACJ,CAAC;AAvBD,0CAuBC","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,4 +1,3 @@
1
- /// <reference types="react" />
2
- import "./MapManagerSettings.scss";
3
- export declare function MapManagerSettings(): JSX.Element;
1
+ import "./MapManagerSettings.scss";
2
+ export declare function MapManagerSettings(): JSX.Element;
4
3
  //# sourceMappingURL=MapManagerSettings.d.ts.map