@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.
- package/lib/cjs/MapLayerPreferences.d.ts +88 -88
- package/lib/cjs/MapLayerPreferences.js +311 -311
- package/lib/cjs/MapLayerPreferences.js.map +1 -1
- package/lib/cjs/map-layers.d.ts +6 -6
- package/lib/cjs/map-layers.js +22 -22
- package/lib/cjs/mapLayers.d.ts +44 -44
- package/lib/cjs/mapLayers.js +61 -61
- package/lib/cjs/mapLayers.js.map +1 -1
- package/lib/cjs/ui/FeatureInfoUiItemsProvider.d.ts +11 -11
- package/lib/cjs/ui/FeatureInfoUiItemsProvider.js +51 -51
- package/lib/cjs/ui/FeatureInfoUiItemsProvider.js.map +1 -1
- package/lib/cjs/ui/Interfaces.d.ts +50 -50
- package/lib/cjs/ui/Interfaces.js +2 -2
- package/lib/cjs/ui/Interfaces.js.map +1 -1
- package/lib/cjs/ui/MapFeatureInfoTool.d.ts +13 -13
- package/lib/cjs/ui/MapFeatureInfoTool.js +50 -50
- package/lib/cjs/ui/MapFeatureInfoTool.js.map +1 -1
- package/lib/cjs/ui/MapLayersUiItemsProvider.d.ts +8 -8
- package/lib/cjs/ui/MapLayersUiItemsProvider.js +38 -38
- package/lib/cjs/ui/MapLayersUiItemsProvider.js.map +1 -1
- package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts +14 -14
- package/lib/cjs/ui/widget/AttachLayerPopupButton.js +335 -335
- package/lib/cjs/ui/widget/BasemapPanel.d.ts +8 -8
- package/lib/cjs/ui/widget/BasemapPanel.js +156 -156
- package/lib/cjs/ui/widget/BasemapPanel.js.map +1 -1
- package/lib/cjs/ui/widget/BasemapPanel.scss +87 -87
- package/lib/cjs/ui/widget/ConfirmMessageDialog.d.ts +21 -21
- package/lib/cjs/ui/widget/ConfirmMessageDialog.js +22 -22
- package/lib/cjs/ui/widget/ConfirmMessageDialog.js.map +1 -1
- package/lib/cjs/ui/widget/FeatureInfoDataProvider.d.ts +40 -40
- package/lib/cjs/ui/widget/FeatureInfoDataProvider.js +138 -138
- package/lib/cjs/ui/widget/FeatureInfoDataProvider.js.map +1 -1
- package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts +7 -7
- package/lib/cjs/ui/widget/FeatureInfoWidget.js +65 -65
- package/lib/cjs/ui/widget/FeatureInfoWidget.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayerDroppable.d.ts +19 -19
- package/lib/cjs/ui/widget/MapLayerDroppable.js +85 -85
- package/lib/cjs/ui/widget/MapLayerDroppable.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayerManager.d.ts +26 -26
- package/lib/cjs/ui/widget/MapLayerManager.js +401 -401
- package/lib/cjs/ui/widget/MapLayerManager.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayerManager.scss +409 -409
- package/lib/cjs/ui/widget/MapLayerSettingsMenu.d.ts +12 -12
- package/lib/cjs/ui/widget/MapLayerSettingsMenu.js +82 -82
- package/lib/cjs/ui/widget/MapLayerSettingsMenu.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.d.ts +7 -7
- package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js +65 -65
- package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.scss +20 -20
- package/lib/cjs/ui/widget/MapLayersWidget.d.ts +11 -11
- package/lib/cjs/ui/widget/MapLayersWidget.js +31 -31
- package/lib/cjs/ui/widget/MapLayersWidget.js.map +1 -1
- package/lib/cjs/ui/widget/MapManagerSettings.d.ts +3 -3
- package/lib/cjs/ui/widget/MapManagerSettings.js +200 -200
- package/lib/cjs/ui/widget/MapManagerSettings.js.map +1 -1
- package/lib/cjs/ui/widget/MapManagerSettings.scss +29 -29
- package/lib/cjs/ui/widget/MapUrlDialog.d.ts +23 -23
- package/lib/cjs/ui/widget/MapUrlDialog.d.ts.map +1 -1
- package/lib/cjs/ui/widget/MapUrlDialog.js +530 -524
- package/lib/cjs/ui/widget/MapUrlDialog.js.map +1 -1
- package/lib/cjs/ui/widget/MapUrlDialog.scss +100 -100
- package/lib/cjs/ui/widget/SelectMapFormat.d.ts +18 -18
- package/lib/cjs/ui/widget/SelectMapFormat.js +54 -54
- package/lib/cjs/ui/widget/SelectMapFormat.js.map +1 -1
- package/lib/cjs/ui/widget/SubLayersDataProvider.d.ts +20 -20
- package/lib/cjs/ui/widget/SubLayersDataProvider.js +75 -75
- package/lib/cjs/ui/widget/SubLayersDataProvider.js.map +1 -1
- package/lib/cjs/ui/widget/SubLayersPopupButton.d.ts +10 -10
- package/lib/cjs/ui/widget/SubLayersPopupButton.js +40 -40
- package/lib/cjs/ui/widget/SubLayersPopupButton.js.map +1 -1
- package/lib/cjs/ui/widget/SubLayersTree.d.ts +15 -15
- package/lib/cjs/ui/widget/SubLayersTree.js +413 -413
- package/lib/cjs/ui/widget/SubLayersTree.js.map +1 -1
- package/lib/cjs/ui/widget/SubLayersTree.scss +69 -69
- package/lib/cjs/ui/widget/TransparencyPopupButton.d.ts +14 -14
- package/lib/cjs/ui/widget/TransparencyPopupButton.js +47 -47
- package/lib/cjs/ui/widget/TransparencyPopupButton.js.map +1 -1
- package/lib/cjs/ui/widget/TransparencyPopupButton.scss +36 -36
- package/lib/esm/MapLayerPreferences.d.ts +88 -88
- package/lib/esm/MapLayerPreferences.js +307 -307
- package/lib/esm/MapLayerPreferences.js.map +1 -1
- package/lib/esm/map-layers.d.ts +6 -6
- package/lib/esm/map-layers.js +10 -10
- package/lib/esm/mapLayers.d.ts +44 -44
- package/lib/esm/mapLayers.js +57 -57
- package/lib/esm/mapLayers.js.map +1 -1
- package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts +11 -11
- package/lib/esm/ui/FeatureInfoUiItemsProvider.js +47 -47
- package/lib/esm/ui/FeatureInfoUiItemsProvider.js.map +1 -1
- package/lib/esm/ui/Interfaces.d.ts +50 -50
- package/lib/esm/ui/Interfaces.js +1 -1
- package/lib/esm/ui/Interfaces.js.map +1 -1
- package/lib/esm/ui/MapFeatureInfoTool.d.ts +13 -13
- package/lib/esm/ui/MapFeatureInfoTool.js +45 -45
- package/lib/esm/ui/MapFeatureInfoTool.js.map +1 -1
- package/lib/esm/ui/MapLayersUiItemsProvider.d.ts +8 -8
- package/lib/esm/ui/MapLayersUiItemsProvider.js +34 -34
- package/lib/esm/ui/MapLayersUiItemsProvider.js.map +1 -1
- package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts +14 -14
- package/lib/esm/ui/widget/AttachLayerPopupButton.js +331 -331
- package/lib/esm/ui/widget/BasemapPanel.d.ts +8 -8
- package/lib/esm/ui/widget/BasemapPanel.js +152 -152
- package/lib/esm/ui/widget/BasemapPanel.js.map +1 -1
- package/lib/esm/ui/widget/BasemapPanel.scss +87 -87
- package/lib/esm/ui/widget/ConfirmMessageDialog.d.ts +21 -21
- package/lib/esm/ui/widget/ConfirmMessageDialog.js +18 -18
- package/lib/esm/ui/widget/ConfirmMessageDialog.js.map +1 -1
- package/lib/esm/ui/widget/FeatureInfoDataProvider.d.ts +40 -40
- package/lib/esm/ui/widget/FeatureInfoDataProvider.js +134 -134
- package/lib/esm/ui/widget/FeatureInfoDataProvider.js.map +1 -1
- package/lib/esm/ui/widget/FeatureInfoWidget.d.ts +7 -7
- package/lib/esm/ui/widget/FeatureInfoWidget.js +61 -61
- package/lib/esm/ui/widget/FeatureInfoWidget.js.map +1 -1
- package/lib/esm/ui/widget/MapLayerDroppable.d.ts +19 -19
- package/lib/esm/ui/widget/MapLayerDroppable.js +81 -81
- package/lib/esm/ui/widget/MapLayerDroppable.js.map +1 -1
- package/lib/esm/ui/widget/MapLayerManager.d.ts +26 -26
- package/lib/esm/ui/widget/MapLayerManager.js +396 -396
- package/lib/esm/ui/widget/MapLayerManager.js.map +1 -1
- package/lib/esm/ui/widget/MapLayerManager.scss +409 -409
- package/lib/esm/ui/widget/MapLayerSettingsMenu.d.ts +12 -12
- package/lib/esm/ui/widget/MapLayerSettingsMenu.js +78 -78
- package/lib/esm/ui/widget/MapLayerSettingsMenu.js.map +1 -1
- package/lib/esm/ui/widget/MapLayerSettingsPopupButton.d.ts +7 -7
- package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js +61 -61
- package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
- package/lib/esm/ui/widget/MapLayerSettingsPopupButton.scss +20 -20
- package/lib/esm/ui/widget/MapLayersWidget.d.ts +11 -11
- package/lib/esm/ui/widget/MapLayersWidget.js +27 -27
- package/lib/esm/ui/widget/MapLayersWidget.js.map +1 -1
- package/lib/esm/ui/widget/MapManagerSettings.d.ts +3 -3
- package/lib/esm/ui/widget/MapManagerSettings.js +196 -196
- package/lib/esm/ui/widget/MapManagerSettings.js.map +1 -1
- package/lib/esm/ui/widget/MapManagerSettings.scss +29 -29
- package/lib/esm/ui/widget/MapUrlDialog.d.ts +23 -23
- package/lib/esm/ui/widget/MapUrlDialog.d.ts.map +1 -1
- package/lib/esm/ui/widget/MapUrlDialog.js +526 -520
- package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
- package/lib/esm/ui/widget/MapUrlDialog.scss +100 -100
- package/lib/esm/ui/widget/SelectMapFormat.d.ts +18 -18
- package/lib/esm/ui/widget/SelectMapFormat.js +50 -50
- package/lib/esm/ui/widget/SelectMapFormat.js.map +1 -1
- package/lib/esm/ui/widget/SubLayersDataProvider.d.ts +20 -20
- package/lib/esm/ui/widget/SubLayersDataProvider.js +71 -71
- package/lib/esm/ui/widget/SubLayersDataProvider.js.map +1 -1
- package/lib/esm/ui/widget/SubLayersPopupButton.d.ts +10 -10
- package/lib/esm/ui/widget/SubLayersPopupButton.js +36 -36
- package/lib/esm/ui/widget/SubLayersPopupButton.js.map +1 -1
- package/lib/esm/ui/widget/SubLayersTree.d.ts +15 -15
- package/lib/esm/ui/widget/SubLayersTree.js +408 -408
- package/lib/esm/ui/widget/SubLayersTree.js.map +1 -1
- package/lib/esm/ui/widget/SubLayersTree.scss +69 -69
- package/lib/esm/ui/widget/TransparencyPopupButton.d.ts +14 -14
- package/lib/esm/ui/widget/TransparencyPopupButton.js +43 -43
- package/lib/esm/ui/widget/TransparencyPopupButton.js.map +1 -1
- package/lib/esm/ui/widget/TransparencyPopupButton.scss +36 -36
- 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,83 +1,83 @@
|
|
|
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?.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
|
-
if (activeViewport) {
|
|
48
|
-
const newTransparency = value;
|
|
49
|
-
const displayStyle = activeViewport.displayStyle;
|
|
50
|
-
const indexInDisplayStyle = displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);
|
|
51
|
-
if (-1 !== indexInDisplayStyle) {
|
|
52
|
-
const styleTransparency = displayStyle.mapLayerAtIndex(indexInDisplayStyle, mapLayerSettings.isOverlay)?.transparency;
|
|
53
|
-
const styleTransparencyValue = styleTransparency ? styleTransparency : 0;
|
|
54
|
-
if (Math.abs(styleTransparencyValue - newTransparency) > 0.01) {
|
|
55
|
-
// update the display style
|
|
56
|
-
displayStyle.changeMapLayerProps({ transparency: newTransparency }, indexInDisplayStyle, mapLayerSettings.isOverlay);
|
|
57
|
-
activeViewport.invalidateRenderPlan();
|
|
58
|
-
// force UI to update
|
|
59
|
-
// loadMapLayerSettingsFromStyle(activeViewport.displayStyle);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}, [activeViewport, mapLayerSettings]);
|
|
64
|
-
const handleTransparencyChange = React.useCallback((values) => {
|
|
65
|
-
if (values.length) {
|
|
66
|
-
const newTransparency = values[0] / 100.0;
|
|
67
|
-
if (newTransparency !== transparency) {
|
|
68
|
-
setTransparency(newTransparency);
|
|
69
|
-
applyTransparencyChange(newTransparency);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}, [transparency, applyTransparencyChange]);
|
|
73
|
-
return (React.createElement(React.Fragment, null,
|
|
74
|
-
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 }),
|
|
75
|
-
React.createElement(core_react_1.ContextMenu, { opened: isSettingsOpen && (undefined !== hasRangeData), onOutsideClick: handleCloseSetting },
|
|
76
|
-
React.createElement("div", { className: "map-manager-item-menu" },
|
|
77
|
-
React.createElement(core_react_1.ContextMenuItem, { hideIconContainer: true, key: 0, className: hasRangeData ? "" : "core-context-menu-disabled", onSelect: handleZoomToLayer }, labelZoomToLayer),
|
|
78
|
-
React.createElement(core_react_1.ContextMenuItem, { hideIconContainer: true, key: 1, onSelect: handleRemoveLayer }, labelDetach),
|
|
79
|
-
React.createElement(core_react_1.ContextMenuItem, { hideIconContainer: true, key: 2 },
|
|
80
|
-
React.createElement(itwinui_react_1.Slider, { min: 0, max: 100, values: [transparency * 100], step: 1, onChange: handleTransparencyChange }))))));
|
|
81
|
-
}
|
|
82
|
-
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?.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
|
+
if (activeViewport) {
|
|
48
|
+
const newTransparency = value;
|
|
49
|
+
const displayStyle = activeViewport.displayStyle;
|
|
50
|
+
const indexInDisplayStyle = displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);
|
|
51
|
+
if (-1 !== indexInDisplayStyle) {
|
|
52
|
+
const styleTransparency = displayStyle.mapLayerAtIndex(indexInDisplayStyle, mapLayerSettings.isOverlay)?.transparency;
|
|
53
|
+
const styleTransparencyValue = styleTransparency ? styleTransparency : 0;
|
|
54
|
+
if (Math.abs(styleTransparencyValue - newTransparency) > 0.01) {
|
|
55
|
+
// update the display style
|
|
56
|
+
displayStyle.changeMapLayerProps({ transparency: newTransparency }, indexInDisplayStyle, mapLayerSettings.isOverlay);
|
|
57
|
+
activeViewport.invalidateRenderPlan();
|
|
58
|
+
// force UI to update
|
|
59
|
+
// loadMapLayerSettingsFromStyle(activeViewport.displayStyle);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}, [activeViewport, mapLayerSettings]);
|
|
64
|
+
const handleTransparencyChange = React.useCallback((values) => {
|
|
65
|
+
if (values.length) {
|
|
66
|
+
const newTransparency = values[0] / 100.0;
|
|
67
|
+
if (newTransparency !== transparency) {
|
|
68
|
+
setTransparency(newTransparency);
|
|
69
|
+
applyTransparencyChange(newTransparency);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}, [transparency, applyTransparencyChange]);
|
|
73
|
+
return (React.createElement(React.Fragment, null,
|
|
74
|
+
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 }),
|
|
75
|
+
React.createElement(core_react_1.ContextMenu, { opened: isSettingsOpen && (undefined !== hasRangeData), onOutsideClick: handleCloseSetting },
|
|
76
|
+
React.createElement("div", { className: "map-manager-item-menu" },
|
|
77
|
+
React.createElement(core_react_1.ContextMenuItem, { hideIconContainer: true, key: 0, className: hasRangeData ? "" : "core-context-menu-disabled", onSelect: handleZoomToLayer }, labelZoomToLayer),
|
|
78
|
+
React.createElement(core_react_1.ContextMenuItem, { hideIconContainer: true, key: 1, onSelect: handleRemoveLayer }, labelDetach),
|
|
79
|
+
React.createElement(core_react_1.ContextMenuItem, { hideIconContainer: true, key: 2 },
|
|
80
|
+
React.createElement(itwinui_react_1.Slider, { min: 0, max: 100, values: [transparency * 100], step: 1, onChange: handleTransparencyChange }))))));
|
|
81
|
+
}
|
|
82
|
+
exports.MapLayerSettingsMenu = MapLayerSettingsMenu;
|
|
83
83
|
//# 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;AA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YAAY,CAAC,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
|
+
{"version":3,"file":"MapLayerSettingsMenu.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerSettingsMenu.tsx"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,+BAA+B;AAE/B,k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BAAW,IAAC,MAAM,EAAE,cAAc,IAAI,CAAC,SAAS,KAAK,YAAY,CAAC,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":["/*---------------------------------------------------------------------------------------------\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,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?.current && buttonRef?.current.contains(event.target)) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
// If clicking the panel, this is not an outside clicked
|
|
52
|
-
if (panelRef.current && 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?.current && buttonRef?.current.contains(event.target)) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
// If clicking the panel, this is not an outside clicked
|
|
52
|
+
if (panelRef.current && 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;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,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClE,MAAM,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,uBAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,wCAAwC,CAAC,CAAC,CAAC;IAE9H,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAoB,IAA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AAI,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,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
|
+
{"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,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClE,MAAM,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,uBAAW,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,CAAC,GAAG,EAAE;QAChD,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAExB,MAAM,kBAAkB,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,OAAoB,EAAE,EAAE;QACpE,IAAI,OAAO,CAAC,QAAQ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AAE,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":["/*---------------------------------------------------------------------------------------------\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,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?.iModel.isGeoLocated);
|
|
19
|
-
React.useEffect(() => {
|
|
20
|
-
const updateIsGeoLocated = () => setIsGeoLocated(!!activeViewport?.iModel.isGeoLocated);
|
|
21
|
-
return activeViewport?.iModel.onEcefLocationChanged.addListener(updateIsGeoLocated);
|
|
22
|
-
}, [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?.iModel.isGeoLocated);
|
|
19
|
+
React.useEffect(() => {
|
|
20
|
+
const updateIsGeoLocated = () => setIsGeoLocated(!!activeViewport?.iModel.isGeoLocated);
|
|
21
|
+
return activeViewport?.iModel.onEcefLocationChanged.addListener(updateIsGeoLocated);
|
|
22
|
+
}, [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,KAA2B;IACzD,MAAM,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,uBAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,iCAAiC,CAAC,CAAC,CAAC;IAC1H,MAAM,cAAc,GAAG,IAAA,+BAAiB,GAAE,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,iCAAe,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,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
|
+
{"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,KAA2B;IACzD,MAAM,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,uBAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,iCAAiC,CAAC,CAAC,CAAC;IAC1H,MAAM,cAAc,GAAG,IAAA,+BAAiB,GAAE,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,iCAAe,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,yBAAY;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 );\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
|