@itwin/map-layers 4.0.0-dev.47 → 4.0.0-dev.49

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 (79) hide show
  1. package/lib/cjs/MapLayerPreferences.js +2 -1
  2. package/lib/cjs/MapLayerPreferences.js.map +1 -1
  3. package/lib/cjs/mapLayers.js +3 -2
  4. package/lib/cjs/mapLayers.js.map +1 -1
  5. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js +3 -2
  6. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  7. package/lib/cjs/ui/MapLayersUiItemsProvider.js +2 -2
  8. package/lib/cjs/ui/MapLayersUiItemsProvider.js.map +1 -1
  9. package/lib/cjs/ui/widget/AttachLayerPopupButton.js +15 -12
  10. package/lib/cjs/ui/widget/AttachLayerPopupButton.js.map +1 -1
  11. package/lib/cjs/ui/widget/BasemapPanel.js +1 -1
  12. package/lib/cjs/ui/widget/BasemapPanel.js.map +1 -1
  13. package/lib/cjs/ui/widget/ConfirmMessageDialog.js +7 -4
  14. package/lib/cjs/ui/widget/ConfirmMessageDialog.js.map +1 -1
  15. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js +4 -3
  16. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  17. package/lib/cjs/ui/widget/FeatureInfoWidget.js +16 -10
  18. package/lib/cjs/ui/widget/FeatureInfoWidget.js.map +1 -1
  19. package/lib/cjs/ui/widget/MapLayerDroppable.js +7 -4
  20. package/lib/cjs/ui/widget/MapLayerDroppable.js.map +1 -1
  21. package/lib/cjs/ui/widget/MapLayerManager.js +19 -17
  22. package/lib/cjs/ui/widget/MapLayerManager.js.map +1 -1
  23. package/lib/cjs/ui/widget/MapLayerManager.scss +1 -1
  24. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js +3 -2
  25. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  26. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js +2 -2
  27. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  28. package/lib/cjs/ui/widget/MapLayersWidget.js +4 -4
  29. package/lib/cjs/ui/widget/MapLayersWidget.js.map +1 -1
  30. package/lib/cjs/ui/widget/MapUrlDialog.js +27 -24
  31. package/lib/cjs/ui/widget/MapUrlDialog.js.map +1 -1
  32. package/lib/cjs/ui/widget/MapUrlDialog.scss +1 -1
  33. package/lib/cjs/ui/widget/SelectMapFormat.js +12 -7
  34. package/lib/cjs/ui/widget/SelectMapFormat.js.map +1 -1
  35. package/lib/cjs/ui/widget/SubLayersDataProvider.js +5 -4
  36. package/lib/cjs/ui/widget/SubLayersDataProvider.js.map +1 -1
  37. package/lib/cjs/ui/widget/SubLayersTree.js +34 -28
  38. package/lib/cjs/ui/widget/SubLayersTree.js.map +1 -1
  39. package/lib/cjs/ui/widget/SubLayersTree.scss +2 -1
  40. package/lib/esm/MapLayerPreferences.js +2 -1
  41. package/lib/esm/MapLayerPreferences.js.map +1 -1
  42. package/lib/esm/mapLayers.js +3 -2
  43. package/lib/esm/mapLayers.js.map +1 -1
  44. package/lib/esm/ui/FeatureInfoUiItemsProvider.js +3 -2
  45. package/lib/esm/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  46. package/lib/esm/ui/MapLayersUiItemsProvider.js +2 -2
  47. package/lib/esm/ui/MapLayersUiItemsProvider.js.map +1 -1
  48. package/lib/esm/ui/widget/AttachLayerPopupButton.js +15 -12
  49. package/lib/esm/ui/widget/AttachLayerPopupButton.js.map +1 -1
  50. package/lib/esm/ui/widget/BasemapPanel.js +1 -1
  51. package/lib/esm/ui/widget/BasemapPanel.js.map +1 -1
  52. package/lib/esm/ui/widget/ConfirmMessageDialog.js +7 -4
  53. package/lib/esm/ui/widget/ConfirmMessageDialog.js.map +1 -1
  54. package/lib/esm/ui/widget/FeatureInfoDataProvider.js +4 -3
  55. package/lib/esm/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  56. package/lib/esm/ui/widget/FeatureInfoWidget.js +16 -10
  57. package/lib/esm/ui/widget/FeatureInfoWidget.js.map +1 -1
  58. package/lib/esm/ui/widget/MapLayerDroppable.js +7 -4
  59. package/lib/esm/ui/widget/MapLayerDroppable.js.map +1 -1
  60. package/lib/esm/ui/widget/MapLayerManager.js +19 -17
  61. package/lib/esm/ui/widget/MapLayerManager.js.map +1 -1
  62. package/lib/esm/ui/widget/MapLayerManager.scss +1 -1
  63. package/lib/esm/ui/widget/MapLayerSettingsMenu.js +3 -2
  64. package/lib/esm/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  65. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js +2 -2
  66. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  67. package/lib/esm/ui/widget/MapLayersWidget.js +4 -4
  68. package/lib/esm/ui/widget/MapLayersWidget.js.map +1 -1
  69. package/lib/esm/ui/widget/MapUrlDialog.js +27 -24
  70. package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
  71. package/lib/esm/ui/widget/MapUrlDialog.scss +1 -1
  72. package/lib/esm/ui/widget/SelectMapFormat.js +12 -7
  73. package/lib/esm/ui/widget/SelectMapFormat.js.map +1 -1
  74. package/lib/esm/ui/widget/SubLayersDataProvider.js +5 -4
  75. package/lib/esm/ui/widget/SubLayersDataProvider.js.map +1 -1
  76. package/lib/esm/ui/widget/SubLayersTree.js +34 -28
  77. package/lib/esm/ui/widget/SubLayersTree.js.map +1 -1
  78. package/lib/esm/ui/widget/SubLayersTree.scss +2 -1
  79. package/package.json +29 -22
@@ -1 +1 @@
1
- {"version":3,"file":"MapLayerManager.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerManager.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F,2CAA2C;;;AAE3C,oEAAoE;AACpE,sDAAsD;AAEtD,sDAA2D;AAC3D,oDAAsH;AACtH,wDAG8B;AAC9B,wDAAoD;AACpD,+BAA+B;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e,EAAE,KAAK,CAAC,eAAe,EAAE,cAAc,EACtD,oBAAoB,EAAE,KAAK,CAAC,oBAA2B,EACvD,cAAc,EAAE,KAAK,CAAC,cAAc,EACpC,kBAAkB,EAAE,yBAAyB,EAC7C,6BAA6B,EAAE,2BAA2B,EAC1D,YAAY,EAAE,sBAAsB,GAAI,CACtC,CACU,CAEf,CACoB,CAC9B,CAAC;AACJ,CAAC;AAvaD,0CAuaC","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// cSpell:ignore droppable Sublayer Basemap\n\n// the following quiet warning caused by react-beautiful-dnd package\n/* eslint-disable @typescript-eslint/unbound-method */\n\nimport { assert, BentleyError } from \"@itwin/core-bentley\";\nimport { ImageMapLayerSettings, MapImagerySettings, MapSubLayerProps, MapSubLayerSettings } from \"@itwin/core-common\";\nimport {\n ImageryMapTileTree, IModelApp, MapLayerImageryProvider, MapLayerScaleRangeVisibility, MapLayerSource, MapLayerSources, NotifyMessageDetails, OutputMessagePriority,\n ScreenViewport, TileTreeOwner, Viewport,\n} from \"@itwin/core-frontend\";\nimport { ToggleSwitch } from \"@itwin/itwinui-react\";\nimport * as React from \"react\";\nimport { DragDropContext, DropResult } from \"react-beautiful-dnd\";\nimport { MapLayerPreferences, MapLayerSourceChangeType } from \"../../MapLayerPreferences\";\nimport { MapLayerOptions, StyleMapLayerSettings } from \"../Interfaces\";\nimport { AttachLayerPopupButton } from \"./AttachLayerPopupButton\";\nimport { BasemapPanel } from \"./BasemapPanel\";\nimport { MapLayerDroppable } from \"./MapLayerDroppable\";\nimport \"./MapLayerManager.scss\";\nimport { MapLayerSettingsPopupButton } from \"./MapLayerSettingsPopupButton\";\nimport { MapLayersUI } from \"../../mapLayers\";\n\n/** @internal */\nexport interface SourceMapContextProps {\n readonly sources: MapLayerSource[];\n readonly loadingSources: boolean;\n readonly bases: MapLayerSource[];\n readonly refreshFromStyle: () => void;\n readonly activeViewport?: ScreenViewport;\n readonly backgroundLayers?: StyleMapLayerSettings[];\n readonly overlayLayers?: StyleMapLayerSettings[];\n readonly mapLayerOptions?: MapLayerOptions;\n}\n\n/** @internal */\nexport const SourceMapContext = React.createContext<SourceMapContextProps>({ // eslint-disable-line @typescript-eslint/naming-convention\n sources: [],\n loadingSources: false,\n bases: [],\n refreshFromStyle: () => { },\n});\n\n/** @internal */\nexport function useSourceMapContext(): SourceMapContextProps {\n return React.useContext(SourceMapContext);\n}\n\nfunction getSubLayerProps(subLayerSettings: MapSubLayerSettings[]): MapSubLayerProps[] {\n return subLayerSettings.map((subLayer) => subLayer.toJSON());\n}\n\nfunction getMapLayerSettingsFromViewport(viewport: Viewport, getBackgroundMap: boolean, populateSubLayers = true): StyleMapLayerSettings[] | undefined {\n const displayStyle = viewport.displayStyle;\n if (!displayStyle)\n return undefined;\n\n const layers = new Array<StyleMapLayerSettings>();\n\n const displayStyleLayers = (getBackgroundMap ? displayStyle.backgroundMapLayers : displayStyle.overlayMapLayers);\n for (let layerIndex = 0; layerIndex < displayStyleLayers.length; layerIndex++) {\n const layerSettings = displayStyleLayers[layerIndex];\n const isOverlay = !getBackgroundMap;\n const layerProvider = viewport.getMapLayerImageryProvider(layerIndex, isOverlay);\n const treeVisibility = viewport.getMapLayerScaleRangeVisibility(layerIndex, isOverlay);\n const popSubLayers = populateSubLayers && (layerSettings instanceof ImageMapLayerSettings);\n layers.push({\n visible: layerSettings.visible,\n treeVisibility,\n name: layerSettings.name,\n source: layerSettings.source,\n transparency: layerSettings.transparency,\n transparentBackground: layerSettings.transparentBackground,\n subLayers: popSubLayers ? getSubLayerProps(layerSettings.subLayers) : undefined,\n showSubLayers: false,\n isOverlay,\n layerIndex,\n provider: layerProvider,\n });\n }\n\n // since we want to display higher level maps above lower maps in UI reverse their order here.\n return layers.reverse();\n}\n\ninterface MapLayerManagerProps {\n getContainerForClone: () => HTMLElement;\n activeViewport: ScreenViewport;\n mapLayerOptions?: MapLayerOptions;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function MapLayerManager(props: MapLayerManagerProps) {\n const [mapSources, setMapSources] = React.useState<MapLayerSource[] | undefined>();\n const [loadingSources, setLoadingSources] = React.useState(false);\n const [baseSources, setBaseSources] = React.useState<MapLayerSource[] | undefined>();\n const [overlaysLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.OverlayLayers\"));\n const [underlaysLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.BackgroundLayers\"));\n const { activeViewport, mapLayerOptions } = props;\n const hideExternalMapLayersSection = mapLayerOptions?.hideExternalMapLayers ? mapLayerOptions.hideExternalMapLayers : false;\n const fetchPublicMapLayerSources = mapLayerOptions?.fetchPublicMapLayerSources ? mapLayerOptions.fetchPublicMapLayerSources : false;\n\n // map layer settings from display style\n const [backgroundMapLayers, setBackgroundMapLayers] = React.useState<StyleMapLayerSettings[] | undefined>(getMapLayerSettingsFromViewport(activeViewport, true));\n const [overlayMapLayers, setOverlayMapLayers] = React.useState<StyleMapLayerSettings[] | undefined>(getMapLayerSettingsFromViewport(activeViewport, false));\n\n const loadMapLayerSettingsFromViewport = React.useCallback((viewport: Viewport) => {\n setBackgroundMapLayers(getMapLayerSettingsFromViewport(viewport, true));\n setOverlayMapLayers(getMapLayerSettingsFromViewport(viewport, false));\n }, [setBackgroundMapLayers, setOverlayMapLayers]);\n\n const [backgroundMapVisible, setBackgroundMapVisible] = React.useState(() => {\n if (activeViewport) {\n return activeViewport.viewFlags.backgroundMap;\n }\n return false;\n });\n\n React.useEffect(() => {\n const updateBackgroundMapVisible = () => setBackgroundMapVisible(activeViewport.viewFlags.backgroundMap);\n return activeViewport.onDisplayStyleChanged.addListener(updateBackgroundMapVisible);\n }, [activeViewport]);\n\n // 'isMounted' is used to prevent any async operation once the hook has been\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\n const isMounted = React.useRef(false);\n React.useEffect(() => {\n isMounted.current = true;\n return () => {\n isMounted.current = false;\n };\n });\n\n // Setup onTileTreeLoad events listening.\n // This is needed because we need to know when the imagery provider\n // is created, and be able to monitor to status change.\n React.useEffect(() => {\n const handleTileTreeLoad = (args: TileTreeOwner) => {\n\n // Ignore non-map tile trees\n if (args.tileTree instanceof ImageryMapTileTree) {\n loadMapLayerSettingsFromViewport(activeViewport);\n }\n };\n\n IModelApp.tileAdmin.onTileTreeLoad.addListener(handleTileTreeLoad);\n\n return () => {\n IModelApp.tileAdmin.onTileTreeLoad.removeListener(handleTileTreeLoad);\n };\n\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\n\n React.useEffect(() => {\n const handleScaleRangeVisibilityChanged = (layerIndexes: MapLayerScaleRangeVisibility[]) => {\n const updateLayers = (array: StyleMapLayerSettings[] | undefined) => {\n if (array === undefined)\n return undefined;\n\n return array.map((curStyledLayer) => {\n const foundScaleRangeVisibility = layerIndexes.find((layerIdx)=> layerIdx.index === curStyledLayer.layerIndex && layerIdx.isOverlay === curStyledLayer.isOverlay);\n if (undefined === foundScaleRangeVisibility)\n return curStyledLayer;\n else\n return {...curStyledLayer, treeVisibility:foundScaleRangeVisibility.visibility};\n });\n\n };\n setBackgroundMapLayers(updateLayers(backgroundMapLayers));\n setOverlayMapLayers(updateLayers(overlayMapLayers));\n\n };\n activeViewport.onMapLayerScaleRangeVisibilityChanged.addListener(handleScaleRangeVisibilityChanged);\n\n return () => {\n activeViewport.onMapLayerScaleRangeVisibilityChanged.removeListener(handleScaleRangeVisibilityChanged);\n };\n\n }, [activeViewport, backgroundMapLayers, loadMapLayerSettingsFromViewport, overlayMapLayers]);\n\n // Setup onMapImageryChanged events listening.\n\n React.useEffect(() => {\n const handleMapImageryChanged = (args: Readonly<MapImagerySettings>) => {\n\n if (args.backgroundLayers.length !== (backgroundMapLayers ? backgroundMapLayers.length : 0)\n || args.overlayLayers.length !== (overlayMapLayers ? overlayMapLayers.length : 0)) {\n loadMapLayerSettingsFromViewport(activeViewport);\n }\n };\n activeViewport?.displayStyle.settings.onMapImageryChanged.addListener(handleMapImageryChanged);\n\n return () => {\n activeViewport?.displayStyle.settings.onMapImageryChanged.removeListener(handleMapImageryChanged);\n };\n }, [activeViewport, backgroundMapLayers, loadMapLayerSettingsFromViewport, overlayMapLayers]);\n\n const handleProviderStatusChanged = React.useCallback((_args: MapLayerImageryProvider) => {\n loadMapLayerSettingsFromViewport(activeViewport);\n }, [loadMapLayerSettingsFromViewport, activeViewport]);\n\n // Triggered whenever a provider status change\n React.useEffect(() => {\n backgroundMapLayers?.forEach((layer) => { layer.provider?.onStatusChanged.addListener(handleProviderStatusChanged); });\n overlayMapLayers?.forEach((layer) => { layer.provider?.onStatusChanged.addListener(handleProviderStatusChanged); });\n\n return () => {\n backgroundMapLayers?.forEach((layer) => { layer.provider?.onStatusChanged.removeListener(handleProviderStatusChanged); });\n overlayMapLayers?.forEach((layer) => { layer.provider?.onStatusChanged.removeListener(handleProviderStatusChanged); });\n };\n\n }, [backgroundMapLayers, overlayMapLayers, activeViewport, loadMapLayerSettingsFromViewport, handleProviderStatusChanged]);\n\n // Monitor viewport updates, and refresh the widget accordingly.\n // Note: This is needed for multiple viewport applications.\n React.useEffect(() => {\n // Update background map status\n setBackgroundMapVisible(activeViewport.viewFlags.backgroundMap);\n\n // Refresh list of layers\n loadMapLayerSettingsFromViewport(activeViewport);\n\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\n\n React.useEffect(() => {\n async function fetchWmsMapData() {\n const sources: MapLayerSource[] = [];\n const bases: MapLayerSource[] = [];\n const sourceLayers = await MapLayerSources.create(undefined, (fetchPublicMapLayerSources && !hideExternalMapLayersSection));\n\n const iModel = IModelApp.viewManager.selectedView ? IModelApp.viewManager.selectedView.iModel : undefined;\n try {\n const preferenceSources = ( iModel?.iTwinId === undefined\n ? []\n : await MapLayerPreferences.getSources(iModel?.iTwinId, iModel?.iModelId)\n );\n for (const source of preferenceSources)\n await MapLayerSources.addSourceToMapLayerSources(source);\n } catch (err) {\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.ErrorLoadingLayers\"), BentleyError.getErrorMessage(err)));\n }\n\n if (!isMounted.current) {\n return;\n }\n\n // This is where the list of layers first gets populated... I need to update it\n // MapUrlDialog gets around knowing MapLayerManager exists and vice versa by affecting the viewports displayStyle which MapLayerManager is listening for\n // We know when displayStyle changes we've added a layer, this layer may not be a custom layer\n sourceLayers?.layers.forEach((source: MapLayerSource) => { sources.push(source); });\n setMapSources(sources);\n sourceLayers?.bases.forEach((source: MapLayerSource) => { bases.push(source); });\n setBaseSources(bases);\n }\n\n setLoadingSources(true);\n fetchWmsMapData().then(() => {\n if (isMounted.current) {\n setLoadingSources(false);\n }\n\n }).catch(() => {\n if (isMounted.current) {\n setLoadingSources(false);\n }\n });\n }, [setMapSources, fetchPublicMapLayerSources, hideExternalMapLayersSection]);\n\n const updateMapSources = React.useCallback(() => {\n const newSources: MapLayerSource[] = [];\n MapLayerSources.getInstance()?.layers?.forEach((sourceLayer: MapLayerSource) => { newSources.push(sourceLayer); });\n setMapSources(newSources);\n }, [setMapSources]);\n\n /**\n * Handle change events in the MapLayerPreferences\n */\n React.useEffect(() => {\n const handleLayerSourceChange = async (changeType: MapLayerSourceChangeType, oldSource?: MapLayerSource, newSource?: MapLayerSource) => {\n const removeSourceOnly = (changeType === MapLayerSourceChangeType.Removed);\n const removeSource = (changeType === MapLayerSourceChangeType.Replaced || changeType === MapLayerSourceChangeType.Removed);\n const addSource = (changeType === MapLayerSourceChangeType.Replaced || changeType === MapLayerSourceChangeType.Added);\n\n if (removeSource) {\n if (oldSource) {\n const succeeded = MapLayerSources.removeLayerByName(oldSource.name);\n assert(succeeded);\n if (!succeeded) {\n return;\n }\n\n if (removeSourceOnly) {\n updateMapSources();\n return;\n }\n }\n }\n\n if (addSource) {\n const sources = await MapLayerSources.addSourceToMapLayerSources(newSource);\n assert(sources !== undefined);\n if (sources) {\n updateMapSources();\n }\n }\n };\n MapLayerPreferences.onLayerSourceChanged.addListener(handleLayerSourceChange);\n return (() => {\n MapLayerPreferences.onLayerSourceChanged.removeListener(handleLayerSourceChange);\n });\n }, [updateMapSources]);\n\n // update when a different display style is loaded.\n React.useEffect(() => {\n const handleDisplayStyleChange = (vp: Viewport) => {\n loadMapLayerSettingsFromViewport(vp);\n };\n activeViewport?.onDisplayStyleChanged.addListener(handleDisplayStyleChange);\n return () => {\n activeViewport?.onDisplayStyleChanged.removeListener(handleDisplayStyleChange);\n };\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\n\n const handleOnMenuItemSelection = React.useCallback((action: string, mapLayerSettings: StyleMapLayerSettings) => {\n if (!activeViewport || !activeViewport.displayStyle)\n return;\n\n const indexInDisplayStyle = activeViewport.displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);\n if (indexInDisplayStyle < 0)\n return;\n\n switch (action) {\n case \"delete\":\n activeViewport.displayStyle.detachMapLayerByIndex(indexInDisplayStyle, mapLayerSettings.isOverlay);\n break;\n case \"zoom-to-layer\":\n activeViewport.displayStyle.viewMapLayerRange(indexInDisplayStyle, mapLayerSettings.isOverlay, activeViewport).then((status) => {\n if (!status) {\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.NoRangeDefined\");\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, `${msg} [${mapLayerSettings.name}]`));\n }\n }).catch((_error) => { });\n break;\n }\n activeViewport.invalidateRenderPlan();\n\n // force UI to update\n loadMapLayerSettingsFromViewport(activeViewport);\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\n\n const handleLayerVisibilityChange = React.useCallback((mapLayerSettings: StyleMapLayerSettings) => {\n if (activeViewport) {\n const isVisible = !mapLayerSettings.visible;\n\n const displayStyle = activeViewport.displayStyle;\n const indexInDisplayStyle = displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);\n if (-1 !== indexInDisplayStyle) {\n // update the display style\n displayStyle.changeMapLayerProps({ visible: isVisible }, indexInDisplayStyle, mapLayerSettings.isOverlay);\n activeViewport.invalidateRenderPlan();\n\n // force UI to update\n loadMapLayerSettingsFromViewport(activeViewport);\n }\n }\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\n\n const handleMapLayersToggle = React.useCallback(() => {\n if (activeViewport) {\n const newState = !backgroundMapVisible;\n activeViewport.viewFlags = activeViewport.viewFlags.with(\"backgroundMap\", newState);\n setBackgroundMapVisible(newState);\n }\n }, [backgroundMapVisible, setBackgroundMapVisible, activeViewport]);\n\n const handleOnMapLayerDragEnd = React.useCallback((result: DropResult /* , _provided: ResponderProvided*/) => {\n const { destination, source } = result;\n\n if (!destination) // dropped outside of list\n return;\n\n // item was not moved\n if (destination.droppableId === source.droppableId && destination.index === source.index)\n return;\n\n let fromMapLayer: StyleMapLayerSettings | undefined;\n if (source.droppableId === \"overlayMapLayers\" && overlayMapLayers)\n fromMapLayer = overlayMapLayers[source.index];\n else if (source.droppableId === \"backgroundMapLayers\" && backgroundMapLayers)\n fromMapLayer = backgroundMapLayers[source.index];\n\n if (!fromMapLayer || !activeViewport)\n return;\n\n const displayStyle = activeViewport.displayStyle;\n let toMapLayer: StyleMapLayerSettings | undefined;\n let toIndexInDisplayStyle = -1;\n\n // If destination.index is undefined then the user dropped the map at the end of list of maps. To get the \"actual\" index in the style, look up index in style by name.\n // We need to do this because the order of layers in UI are reversed so higher layers appear above lower layers.\n if (undefined !== destination.index) {\n if (destination.droppableId === \"overlayMapLayers\" && overlayMapLayers)\n toMapLayer = overlayMapLayers[destination.index];\n else if (destination.droppableId === \"backgroundMapLayers\" && backgroundMapLayers)\n toMapLayer = backgroundMapLayers[destination.index];\n if (toMapLayer)\n toIndexInDisplayStyle = displayStyle.findMapLayerIndexByNameAndSource(toMapLayer.name, toMapLayer.source, toMapLayer.isOverlay);\n }\n\n const fromIndexInDisplayStyle = displayStyle.findMapLayerIndexByNameAndSource(fromMapLayer.name, fromMapLayer.source, fromMapLayer.isOverlay);\n if (fromIndexInDisplayStyle < 0)\n return;\n\n if (destination.droppableId !== source.droppableId) {\n // see if we moved from \"overlayMapLayers\" to \"backgroundMapLayers\" or vice-versa\n const settings = activeViewport.displayStyle.mapLayerAtIndex(fromIndexInDisplayStyle, fromMapLayer.isOverlay);\n if (settings) {\n activeViewport.displayStyle.detachMapLayerByIndex(fromIndexInDisplayStyle, fromMapLayer.isOverlay);\n\n // Manually reverse index when moved from one section to the other\n if (fromMapLayer.isOverlay && backgroundMapLayers) {\n toIndexInDisplayStyle = displayStyle.backgroundMapLayers.length - destination.index;\n } else if (!fromMapLayer.isOverlay && overlayMapLayers) {\n toIndexInDisplayStyle = overlayMapLayers.length - destination.index;\n }\n\n activeViewport.displayStyle.attachMapLayer({settings, isOverlay:!fromMapLayer.isOverlay, insertIndex:toIndexInDisplayStyle});\n }\n } else {\n if (undefined === destination.index) {\n displayStyle.moveMapLayerToBottom(fromIndexInDisplayStyle, destination.droppableId === \"overlayMapLayers\");\n } else {\n if (toMapLayer) {\n if (toIndexInDisplayStyle !== -1)\n displayStyle.moveMapLayerToIndex(fromIndexInDisplayStyle, toIndexInDisplayStyle, toMapLayer.isOverlay);\n }\n }\n }\n\n // apply display style change to view\n activeViewport.invalidateRenderPlan();\n\n // force UI to update\n loadMapLayerSettingsFromViewport(activeViewport);\n }, [loadMapLayerSettingsFromViewport, activeViewport, overlayMapLayers, backgroundMapLayers]);\n\n const handleRefreshFromStyle = React.useCallback(() => {\n if (activeViewport)\n loadMapLayerSettingsFromViewport(activeViewport);\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\n\n const [baseMapPanelLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.BaseMapPanelTitle\"));\n\n return (\n <SourceMapContext.Provider value={{\n activeViewport,\n loadingSources,\n sources: mapSources ? mapSources : [],\n bases: baseSources ? baseSources : [],\n refreshFromStyle: handleRefreshFromStyle,\n backgroundLayers: backgroundMapLayers,\n overlayLayers: overlayMapLayers,\n mapLayerOptions,\n }}>\n <div className=\"map-manager-top-header\">\n <span className=\"map-manager-header-label\">{baseMapPanelLabel}</span>\n <div className=\"map-manager-header-buttons-group\">\n <ToggleSwitch className=\"map-manager-toggle\" checked={backgroundMapVisible} onChange={handleMapLayersToggle} />\n <MapLayerSettingsPopupButton disabled={!backgroundMapVisible}/>\n </div>\n </div>\n\n <div className=\"map-manager-container\">\n\n <div className=\"map-manager-basemap\">\n <BasemapPanel disabled={!backgroundMapVisible} />\n </div>\n {!hideExternalMapLayersSection &&\n <DragDropContext onDragEnd={handleOnMapLayerDragEnd}>\n <div className=\"map-manager-layer-wrapper\">\n <div className=\"map-manager-underlays\" >\n <span className=\"map-manager-underlays-label\">{underlaysLabel}</span><AttachLayerPopupButton disabled={!backgroundMapVisible} isOverlay={false} />\n </div>\n <MapLayerDroppable\n disabled={!backgroundMapVisible}\n isOverlay={false}\n layersList={backgroundMapLayers}\n mapTypesOptions={props.mapLayerOptions?.mapTypeOptions}\n getContainerForClone={props.getContainerForClone as any}\n activeViewport={props.activeViewport}\n onMenuItemSelected={handleOnMenuItemSelection}\n onItemVisibilityToggleClicked={handleLayerVisibilityChange}\n onItemEdited={handleRefreshFromStyle} />\n </div>\n\n <div className=\"map-manager-layer-wrapper\">\n <div className=\"map-manager-overlays\" >\n <span className=\"map-manager-overlays-label\">{overlaysLabel}</span><AttachLayerPopupButton disabled={!backgroundMapVisible} isOverlay={true} />\n </div>\n <MapLayerDroppable\n disabled={!backgroundMapVisible}\n isOverlay={true}\n layersList={overlayMapLayers}\n mapTypesOptions={props.mapLayerOptions?.mapTypeOptions}\n getContainerForClone={props.getContainerForClone as any}\n activeViewport={props.activeViewport}\n onMenuItemSelected={handleOnMenuItemSelection}\n onItemVisibilityToggleClicked={handleLayerVisibilityChange}\n onItemEdited={handleRefreshFromStyle} />\n </div>\n </DragDropContext>\n }\n </div >\n </SourceMapContext.Provider >\n );\n}\n\n"]}
1
+ {"version":3,"file":"MapLayerManager.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerManager.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F,2CAA2C;;;AAE3C,oEAAoE;AACpE,sDAAsD;AAEtD,sDAA2D;AAC3D,oDAAsH;AACtH,wDAG8B;AAC9B,wDAAoD;AACpD,+BAA+B;AAC/B,6DAAkE;AAClE,mEAA0F;AAE1F,qEAAkE;AAClE,iDAA8C;AAC9C,2DAAwD;AACxD,kCAAgC;AAChC,+EAA4E;AAC5E,+CAA8C;AAc9C,gBAAgB;AACH,QAAA,gBAAgB,GAAG,KAAK,CAAC,aAAa,CAAwB;IACzE,OAAO,EAAE,EAAE;IACX,cAAc,EAAE,KAAK;IACrB,KAAK,EAAE,EAAE;IACT,gBAAgB,EAAE,GAAG,EAAE,GAAG,CAAC;CAC5B,CAAC,CAAC;AAEH,gBAAgB;AAChB,SAAgB,mBAAmB;IACjC,OAAO,KAAK,CAAC,UAAU,CAAC,wBAAgB,CAAC,CAAC;AAC5C,CAAC;AAFD,kDAEC;AAED,SAAS,gBAAgB,CAAC,gBAAuC;IAC/D,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,+BAA+B,CAAC,QAAkB,EAAE,gBAAyB,EAAE,iBAAiB,GAAG,IAAI;IAC9G,MAAM,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC;IAC3C,IAAI,CAAC,YAAY;QACf,OAAO,SAAS,CAAC;IAEnB,MAAM,MAAM,GAAG,IAAI,KAAK,EAAyB,CAAC;IAElD,MAAM,kBAAkB,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC,CAAC,YAAY,CAA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A6B,IAAE,cAAc,CAAQ;4BAAA,oBAAC,+CAAsB,IAAC,QAAQ,EAAE,CAAC,oBAAoB,EAAE,SAAS,EAAE,KAAK,GAAI,CAC9I;wBACN,oBAAC,qCAAiB,IAChB,QAAQ,EAAE,CAAC,oBAAoB,EAC/B,SAAS,EAAE,KAAK,EAChB,UAAU,EAAE,mBAAmB,EAC/B,eAAe,EAAE,MAAA,KAAK,CAAC,eAAe,0CAAE,cAAc,EACtD,oBAAoB,EAAE,KAAK,CAAC,oBAA2B,EACvD,cAAc,EAAE,KAAK,CAAC,cAAc,EACpC,kBAAkB,EAAE,yBAAyB,EAC7C,6BAA6B,EAAE,2BAA2B,EAC1D,YAAY,EAAE,sBAAsB,GAAI,CACtC;oBAEN,6BAAK,SAAS,EAAC,2BAA2B;wBACxC,6BAAK,SAAS,EAAC,sBAAsB;4BACnC,8BAAM,SAAS,EAAC,4BAA4B,IAAE,aAAa,CAAQ;4BAAA,oBAAC,+CAAsB,IAAC,QAAQ,EAAE,CAAC,oBAAoB,EAAE,SAAS,EAAE,IAAI,GAAI,CAC3I;wBACN,oBAAC,qCAAiB,IAChB,QAAQ,EAAE,CAAC,oBAAoB,EAC/B,SAAS,EAAE,IAAI,EACf,UAAU,EAAE,gBAAgB,EAC5B,eAAe,EAAE,MAAA,KAAK,CAAC,eAAe,0CAAE,cAAc,EACtD,oBAAoB,EAAE,KAAK,CAAC,oBAA2B,EACvD,cAAc,EAAE,KAAK,CAAC,cAAc,EACpC,kBAAkB,EAAE,yBAAyB,EAC7C,6BAA6B,EAAE,2BAA2B,EAC1D,YAAY,EAAE,sBAAsB,GAAI,CACtC,CACU,CAEf,CACoB,CAC9B,CAAC;AACJ,CAAC;AAvaD,0CAuaC","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// cSpell:ignore droppable Sublayer Basemap\n\n// the following quiet warning caused by react-beautiful-dnd package\n/* eslint-disable @typescript-eslint/unbound-method */\n\nimport { assert, BentleyError } from \"@itwin/core-bentley\";\nimport { ImageMapLayerSettings, MapImagerySettings, MapSubLayerProps, MapSubLayerSettings } from \"@itwin/core-common\";\nimport {\n ImageryMapTileTree, IModelApp, MapLayerImageryProvider, MapLayerScaleRangeVisibility, MapLayerSource, MapLayerSources, NotifyMessageDetails, OutputMessagePriority,\n ScreenViewport, TileTreeOwner, Viewport,\n} from \"@itwin/core-frontend\";\nimport { ToggleSwitch } from \"@itwin/itwinui-react\";\nimport * as React from \"react\";\nimport { DragDropContext, DropResult } from \"react-beautiful-dnd\";\nimport { MapLayerPreferences, MapLayerSourceChangeType } from \"../../MapLayerPreferences\";\nimport { MapLayerOptions, StyleMapLayerSettings } from \"../Interfaces\";\nimport { AttachLayerPopupButton } from \"./AttachLayerPopupButton\";\nimport { BasemapPanel } from \"./BasemapPanel\";\nimport { MapLayerDroppable } from \"./MapLayerDroppable\";\nimport \"./MapLayerManager.scss\";\nimport { MapLayerSettingsPopupButton } from \"./MapLayerSettingsPopupButton\";\nimport { MapLayersUI } from \"../../mapLayers\";\n\n/** @internal */\nexport interface SourceMapContextProps {\n readonly sources: MapLayerSource[];\n readonly loadingSources: boolean;\n readonly bases: MapLayerSource[];\n readonly refreshFromStyle: () => void;\n readonly activeViewport?: ScreenViewport;\n readonly backgroundLayers?: StyleMapLayerSettings[];\n readonly overlayLayers?: StyleMapLayerSettings[];\n readonly mapLayerOptions?: MapLayerOptions;\n}\n\n/** @internal */\nexport const SourceMapContext = React.createContext<SourceMapContextProps>({ // eslint-disable-line @typescript-eslint/naming-convention\n sources: [],\n loadingSources: false,\n bases: [],\n refreshFromStyle: () => { },\n});\n\n/** @internal */\nexport function useSourceMapContext(): SourceMapContextProps {\n return React.useContext(SourceMapContext);\n}\n\nfunction getSubLayerProps(subLayerSettings: MapSubLayerSettings[]): MapSubLayerProps[] {\n return subLayerSettings.map((subLayer) => subLayer.toJSON());\n}\n\nfunction getMapLayerSettingsFromViewport(viewport: Viewport, getBackgroundMap: boolean, populateSubLayers = true): StyleMapLayerSettings[] | undefined {\n const displayStyle = viewport.displayStyle;\n if (!displayStyle)\n return undefined;\n\n const layers = new Array<StyleMapLayerSettings>();\n\n const displayStyleLayers = (getBackgroundMap ? displayStyle.backgroundMapLayers : displayStyle.overlayMapLayers);\n for (let layerIndex = 0; layerIndex < displayStyleLayers.length; layerIndex++) {\n const layerSettings = displayStyleLayers[layerIndex];\n const isOverlay = !getBackgroundMap;\n const layerProvider = viewport.getMapLayerImageryProvider(layerIndex, isOverlay);\n const treeVisibility = viewport.getMapLayerScaleRangeVisibility(layerIndex, isOverlay);\n const popSubLayers = populateSubLayers && (layerSettings instanceof ImageMapLayerSettings);\n layers.push({\n visible: layerSettings.visible,\n treeVisibility,\n name: layerSettings.name,\n source: layerSettings.source,\n transparency: layerSettings.transparency,\n transparentBackground: layerSettings.transparentBackground,\n subLayers: popSubLayers ? getSubLayerProps(layerSettings.subLayers) : undefined,\n showSubLayers: false,\n isOverlay,\n layerIndex,\n provider: layerProvider,\n });\n }\n\n // since we want to display higher level maps above lower maps in UI reverse their order here.\n return layers.reverse();\n}\n\ninterface MapLayerManagerProps {\n getContainerForClone: () => HTMLElement;\n activeViewport: ScreenViewport;\n mapLayerOptions?: MapLayerOptions;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function MapLayerManager(props: MapLayerManagerProps) {\n const [mapSources, setMapSources] = React.useState<MapLayerSource[] | undefined>();\n const [loadingSources, setLoadingSources] = React.useState(false);\n const [baseSources, setBaseSources] = React.useState<MapLayerSource[] | undefined>();\n const [overlaysLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.OverlayLayers\"));\n const [underlaysLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.BackgroundLayers\"));\n const { activeViewport, mapLayerOptions } = props;\n const hideExternalMapLayersSection = mapLayerOptions?.hideExternalMapLayers ? mapLayerOptions.hideExternalMapLayers : false;\n const fetchPublicMapLayerSources = mapLayerOptions?.fetchPublicMapLayerSources ? mapLayerOptions.fetchPublicMapLayerSources : false;\n\n // map layer settings from display style\n const [backgroundMapLayers, setBackgroundMapLayers] = React.useState<StyleMapLayerSettings[] | undefined>(getMapLayerSettingsFromViewport(activeViewport, true));\n const [overlayMapLayers, setOverlayMapLayers] = React.useState<StyleMapLayerSettings[] | undefined>(getMapLayerSettingsFromViewport(activeViewport, false));\n\n const loadMapLayerSettingsFromViewport = React.useCallback((viewport: Viewport) => {\n setBackgroundMapLayers(getMapLayerSettingsFromViewport(viewport, true));\n setOverlayMapLayers(getMapLayerSettingsFromViewport(viewport, false));\n }, [setBackgroundMapLayers, setOverlayMapLayers]);\n\n const [backgroundMapVisible, setBackgroundMapVisible] = React.useState(() => {\n if (activeViewport) {\n return activeViewport.viewFlags.backgroundMap;\n }\n return false;\n });\n\n React.useEffect(() => {\n const updateBackgroundMapVisible = () => setBackgroundMapVisible(activeViewport.viewFlags.backgroundMap);\n return activeViewport.onDisplayStyleChanged.addListener(updateBackgroundMapVisible);\n }, [activeViewport]);\n\n // 'isMounted' is used to prevent any async operation once the hook has been\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\n const isMounted = React.useRef(false);\n React.useEffect(() => {\n isMounted.current = true;\n return () => {\n isMounted.current = false;\n };\n });\n\n // Setup onTileTreeLoad events listening.\n // This is needed because we need to know when the imagery provider\n // is created, and be able to monitor to status change.\n React.useEffect(() => {\n const handleTileTreeLoad = (args: TileTreeOwner) => {\n\n // Ignore non-map tile trees\n if (args.tileTree instanceof ImageryMapTileTree) {\n loadMapLayerSettingsFromViewport(activeViewport);\n }\n };\n\n IModelApp.tileAdmin.onTileTreeLoad.addListener(handleTileTreeLoad);\n\n return () => {\n IModelApp.tileAdmin.onTileTreeLoad.removeListener(handleTileTreeLoad);\n };\n\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\n\n React.useEffect(() => {\n const handleScaleRangeVisibilityChanged = (layerIndexes: MapLayerScaleRangeVisibility[]) => {\n const updateLayers = (array: StyleMapLayerSettings[] | undefined) => {\n if (array === undefined)\n return undefined;\n\n return array.map((curStyledLayer) => {\n const foundScaleRangeVisibility = layerIndexes.find((layerIdx)=> layerIdx.index === curStyledLayer.layerIndex && layerIdx.isOverlay === curStyledLayer.isOverlay);\n if (undefined === foundScaleRangeVisibility)\n return curStyledLayer;\n else\n return {...curStyledLayer, treeVisibility:foundScaleRangeVisibility.visibility};\n });\n\n };\n setBackgroundMapLayers(updateLayers(backgroundMapLayers));\n setOverlayMapLayers(updateLayers(overlayMapLayers));\n\n };\n activeViewport.onMapLayerScaleRangeVisibilityChanged.addListener(handleScaleRangeVisibilityChanged);\n\n return () => {\n activeViewport.onMapLayerScaleRangeVisibilityChanged.removeListener(handleScaleRangeVisibilityChanged);\n };\n\n }, [activeViewport, backgroundMapLayers, loadMapLayerSettingsFromViewport, overlayMapLayers]);\n\n // Setup onMapImageryChanged events listening.\n\n React.useEffect(() => {\n const handleMapImageryChanged = (args: Readonly<MapImagerySettings>) => {\n\n if (args.backgroundLayers.length !== (backgroundMapLayers ? backgroundMapLayers.length : 0)\n || args.overlayLayers.length !== (overlayMapLayers ? overlayMapLayers.length : 0)) {\n loadMapLayerSettingsFromViewport(activeViewport);\n }\n };\n activeViewport?.displayStyle.settings.onMapImageryChanged.addListener(handleMapImageryChanged);\n\n return () => {\n activeViewport?.displayStyle.settings.onMapImageryChanged.removeListener(handleMapImageryChanged);\n };\n }, [activeViewport, backgroundMapLayers, loadMapLayerSettingsFromViewport, overlayMapLayers]);\n\n const handleProviderStatusChanged = React.useCallback((_args: MapLayerImageryProvider) => {\n loadMapLayerSettingsFromViewport(activeViewport);\n }, [loadMapLayerSettingsFromViewport, activeViewport]);\n\n // Triggered whenever a provider status change\n React.useEffect(() => {\n backgroundMapLayers?.forEach((layer) => { layer.provider?.onStatusChanged.addListener(handleProviderStatusChanged); });\n overlayMapLayers?.forEach((layer) => { layer.provider?.onStatusChanged.addListener(handleProviderStatusChanged); });\n\n return () => {\n backgroundMapLayers?.forEach((layer) => { layer.provider?.onStatusChanged.removeListener(handleProviderStatusChanged); });\n overlayMapLayers?.forEach((layer) => { layer.provider?.onStatusChanged.removeListener(handleProviderStatusChanged); });\n };\n\n }, [backgroundMapLayers, overlayMapLayers, activeViewport, loadMapLayerSettingsFromViewport, handleProviderStatusChanged]);\n\n // Monitor viewport updates, and refresh the widget accordingly.\n // Note: This is needed for multiple viewport applications.\n React.useEffect(() => {\n // Update background map status\n setBackgroundMapVisible(activeViewport.viewFlags.backgroundMap);\n\n // Refresh list of layers\n loadMapLayerSettingsFromViewport(activeViewport);\n\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\n\n React.useEffect(() => {\n async function fetchWmsMapData() {\n const sources: MapLayerSource[] = [];\n const bases: MapLayerSource[] = [];\n const sourceLayers = await MapLayerSources.create(undefined, (fetchPublicMapLayerSources && !hideExternalMapLayersSection));\n\n const iModel = IModelApp.viewManager.selectedView ? IModelApp.viewManager.selectedView.iModel : undefined;\n try {\n const preferenceSources = ( iModel?.iTwinId === undefined\n ? []\n : await MapLayerPreferences.getSources(iModel?.iTwinId, iModel?.iModelId)\n );\n for (const source of preferenceSources)\n await MapLayerSources.addSourceToMapLayerSources(source);\n } catch (err) {\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.ErrorLoadingLayers\"), BentleyError.getErrorMessage(err)));\n }\n\n if (!isMounted.current) {\n return;\n }\n\n // This is where the list of layers first gets populated... I need to update it\n // MapUrlDialog gets around knowing MapLayerManager exists and vice versa by affecting the viewports displayStyle which MapLayerManager is listening for\n // We know when displayStyle changes we've added a layer, this layer may not be a custom layer\n sourceLayers?.layers.forEach((source: MapLayerSource) => { sources.push(source); });\n setMapSources(sources);\n sourceLayers?.bases.forEach((source: MapLayerSource) => { bases.push(source); });\n setBaseSources(bases);\n }\n\n setLoadingSources(true);\n fetchWmsMapData().then(() => {\n if (isMounted.current) {\n setLoadingSources(false);\n }\n\n }).catch(() => {\n if (isMounted.current) {\n setLoadingSources(false);\n }\n });\n }, [setMapSources, fetchPublicMapLayerSources, hideExternalMapLayersSection]);\n\n const updateMapSources = React.useCallback(() => {\n const newSources: MapLayerSource[] = [];\n MapLayerSources.getInstance()?.layers?.forEach((sourceLayer: MapLayerSource) => { newSources.push(sourceLayer); });\n setMapSources(newSources);\n }, [setMapSources]);\n\n /**\n * Handle change events in the MapLayerPreferences\n */\n React.useEffect(() => {\n const handleLayerSourceChange = async (changeType: MapLayerSourceChangeType, oldSource?: MapLayerSource, newSource?: MapLayerSource) => {\n const removeSourceOnly = (changeType === MapLayerSourceChangeType.Removed);\n const removeSource = (changeType === MapLayerSourceChangeType.Replaced || changeType === MapLayerSourceChangeType.Removed);\n const addSource = (changeType === MapLayerSourceChangeType.Replaced || changeType === MapLayerSourceChangeType.Added);\n\n if (removeSource) {\n if (oldSource) {\n const succeeded = MapLayerSources.removeLayerByName(oldSource.name);\n assert(succeeded);\n if (!succeeded) {\n return;\n }\n\n if (removeSourceOnly) {\n updateMapSources();\n return;\n }\n }\n }\n\n if (addSource) {\n const sources = await MapLayerSources.addSourceToMapLayerSources(newSource);\n assert(sources !== undefined);\n if (sources) {\n updateMapSources();\n }\n }\n };\n MapLayerPreferences.onLayerSourceChanged.addListener(handleLayerSourceChange);\n return (() => {\n MapLayerPreferences.onLayerSourceChanged.removeListener(handleLayerSourceChange);\n });\n }, [updateMapSources]);\n\n // update when a different display style is loaded.\n React.useEffect(() => {\n const handleDisplayStyleChange = (vp: Viewport) => {\n loadMapLayerSettingsFromViewport(vp);\n };\n activeViewport?.onDisplayStyleChanged.addListener(handleDisplayStyleChange);\n return () => {\n activeViewport?.onDisplayStyleChanged.removeListener(handleDisplayStyleChange);\n };\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\n\n const handleOnMenuItemSelection = React.useCallback((action: string, mapLayerSettings: StyleMapLayerSettings) => {\n if (!activeViewport || !activeViewport.displayStyle)\n return;\n\n const indexInDisplayStyle = activeViewport.displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);\n if (indexInDisplayStyle < 0)\n return;\n\n switch (action) {\n case \"delete\":\n activeViewport.displayStyle.detachMapLayerByIndex(indexInDisplayStyle, mapLayerSettings.isOverlay);\n break;\n case \"zoom-to-layer\":\n activeViewport.displayStyle.viewMapLayerRange(indexInDisplayStyle, mapLayerSettings.isOverlay, activeViewport).then((status) => {\n if (!status) {\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.NoRangeDefined\");\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, `${msg} [${mapLayerSettings.name}]`));\n }\n }).catch((_error) => { });\n break;\n }\n activeViewport.invalidateRenderPlan();\n\n // force UI to update\n loadMapLayerSettingsFromViewport(activeViewport);\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\n\n const handleLayerVisibilityChange = React.useCallback((mapLayerSettings: StyleMapLayerSettings) => {\n if (activeViewport) {\n const isVisible = !mapLayerSettings.visible;\n\n const displayStyle = activeViewport.displayStyle;\n const indexInDisplayStyle = displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);\n if (-1 !== indexInDisplayStyle) {\n // update the display style\n displayStyle.changeMapLayerProps({ visible: isVisible }, indexInDisplayStyle, mapLayerSettings.isOverlay);\n activeViewport.invalidateRenderPlan();\n\n // force UI to update\n loadMapLayerSettingsFromViewport(activeViewport);\n }\n }\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\n\n const handleMapLayersToggle = React.useCallback(() => {\n if (activeViewport) {\n const newState = !backgroundMapVisible;\n activeViewport.viewFlags = activeViewport.viewFlags.with(\"backgroundMap\", newState);\n setBackgroundMapVisible(newState);\n }\n }, [backgroundMapVisible, setBackgroundMapVisible, activeViewport]);\n\n const handleOnMapLayerDragEnd = React.useCallback((result: DropResult /* , _provided: ResponderProvided*/) => {\n const { destination, source } = result;\n\n if (!destination) // dropped outside of list\n return;\n\n // item was not moved\n if (destination.droppableId === source.droppableId && destination.index === source.index)\n return;\n\n let fromMapLayer: StyleMapLayerSettings | undefined;\n if (source.droppableId === \"overlayMapLayers\" && overlayMapLayers)\n fromMapLayer = overlayMapLayers[source.index];\n else if (source.droppableId === \"backgroundMapLayers\" && backgroundMapLayers)\n fromMapLayer = backgroundMapLayers[source.index];\n\n if (!fromMapLayer || !activeViewport)\n return;\n\n const displayStyle = activeViewport.displayStyle;\n let toMapLayer: StyleMapLayerSettings | undefined;\n let toIndexInDisplayStyle = -1;\n\n // If destination.index is undefined then the user dropped the map at the end of list of maps. To get the \"actual\" index in the style, look up index in style by name.\n // We need to do this because the order of layers in UI are reversed so higher layers appear above lower layers.\n if (undefined !== destination.index) {\n if (destination.droppableId === \"overlayMapLayers\" && overlayMapLayers)\n toMapLayer = overlayMapLayers[destination.index];\n else if (destination.droppableId === \"backgroundMapLayers\" && backgroundMapLayers)\n toMapLayer = backgroundMapLayers[destination.index];\n if (toMapLayer)\n toIndexInDisplayStyle = displayStyle.findMapLayerIndexByNameAndSource(toMapLayer.name, toMapLayer.source, toMapLayer.isOverlay);\n }\n\n const fromIndexInDisplayStyle = displayStyle.findMapLayerIndexByNameAndSource(fromMapLayer.name, fromMapLayer.source, fromMapLayer.isOverlay);\n if (fromIndexInDisplayStyle < 0)\n return;\n\n if (destination.droppableId !== source.droppableId) {\n // see if we moved from \"overlayMapLayers\" to \"backgroundMapLayers\" or vice-versa\n const settings = activeViewport.displayStyle.mapLayerAtIndex(fromIndexInDisplayStyle, fromMapLayer.isOverlay);\n if (settings) {\n activeViewport.displayStyle.detachMapLayerByIndex(fromIndexInDisplayStyle, fromMapLayer.isOverlay);\n\n // Manually reverse index when moved from one section to the other\n if (fromMapLayer.isOverlay && backgroundMapLayers) {\n toIndexInDisplayStyle = displayStyle.backgroundMapLayers.length - destination.index;\n } else if (!fromMapLayer.isOverlay && overlayMapLayers) {\n toIndexInDisplayStyle = overlayMapLayers.length - destination.index;\n }\n\n activeViewport.displayStyle.attachMapLayer({settings, isOverlay:!fromMapLayer.isOverlay, insertIndex:toIndexInDisplayStyle});\n }\n } else {\n if (undefined === destination.index) {\n displayStyle.moveMapLayerToBottom(fromIndexInDisplayStyle, destination.droppableId === \"overlayMapLayers\");\n } else {\n if (toMapLayer) {\n if (toIndexInDisplayStyle !== -1)\n displayStyle.moveMapLayerToIndex(fromIndexInDisplayStyle, toIndexInDisplayStyle, toMapLayer.isOverlay);\n }\n }\n }\n\n // apply display style change to view\n activeViewport.invalidateRenderPlan();\n\n // force UI to update\n loadMapLayerSettingsFromViewport(activeViewport);\n }, [loadMapLayerSettingsFromViewport, activeViewport, overlayMapLayers, backgroundMapLayers]);\n\n const handleRefreshFromStyle = React.useCallback(() => {\n if (activeViewport)\n loadMapLayerSettingsFromViewport(activeViewport);\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\n\n const [baseMapPanelLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.BaseMapPanelTitle\"));\n\n return (\n <SourceMapContext.Provider value={{\n activeViewport,\n loadingSources,\n sources: mapSources ? mapSources : [],\n bases: baseSources ? baseSources : [],\n refreshFromStyle: handleRefreshFromStyle,\n backgroundLayers: backgroundMapLayers,\n overlayLayers: overlayMapLayers,\n mapLayerOptions,\n }}>\n <div className=\"map-manager-top-header\">\n <span className=\"map-manager-header-label\">{baseMapPanelLabel}</span>\n <div className=\"map-manager-header-buttons-group\">\n <ToggleSwitch className=\"map-manager-toggle\" checked={backgroundMapVisible} onChange={handleMapLayersToggle} />\n <MapLayerSettingsPopupButton disabled={!backgroundMapVisible}/>\n </div>\n </div>\n\n <div className=\"map-manager-container\">\n\n <div className=\"map-manager-basemap\">\n <BasemapPanel disabled={!backgroundMapVisible} />\n </div>\n {!hideExternalMapLayersSection &&\n <DragDropContext onDragEnd={handleOnMapLayerDragEnd}>\n <div className=\"map-manager-layer-wrapper\">\n <div className=\"map-manager-underlays\" >\n <span className=\"map-manager-underlays-label\">{underlaysLabel}</span><AttachLayerPopupButton disabled={!backgroundMapVisible} isOverlay={false} />\n </div>\n <MapLayerDroppable\n disabled={!backgroundMapVisible}\n isOverlay={false}\n layersList={backgroundMapLayers}\n mapTypesOptions={props.mapLayerOptions?.mapTypeOptions}\n getContainerForClone={props.getContainerForClone as any}\n activeViewport={props.activeViewport}\n onMenuItemSelected={handleOnMenuItemSelection}\n onItemVisibilityToggleClicked={handleLayerVisibilityChange}\n onItemEdited={handleRefreshFromStyle} />\n </div>\n\n <div className=\"map-manager-layer-wrapper\">\n <div className=\"map-manager-overlays\" >\n <span className=\"map-manager-overlays-label\">{overlaysLabel}</span><AttachLayerPopupButton disabled={!backgroundMapVisible} isOverlay={true} />\n </div>\n <MapLayerDroppable\n disabled={!backgroundMapVisible}\n isOverlay={true}\n layersList={overlayMapLayers}\n mapTypesOptions={props.mapLayerOptions?.mapTypeOptions}\n getContainerForClone={props.getContainerForClone as any}\n activeViewport={props.activeViewport}\n onMenuItemSelected={handleOnMenuItemSelection}\n onItemVisibilityToggleClicked={handleLayerVisibilityChange}\n onItemEdited={handleRefreshFromStyle} />\n </div>\n </DragDropContext>\n }\n </div >\n </SourceMapContext.Provider >\n );\n}\n\n"]}
@@ -268,7 +268,7 @@ $default-font-size: --iui-font-size-1;
268
268
 
269
269
  &:focus {
270
270
  outline: none;
271
- box-shadow: $uicore-button-focus-boxshadow;
271
+ box-shadow: rgba(var(--iui-color-border-accent), var(--iui-opacity-4)) 0px 0px 0px 2px;
272
272
  }
273
273
  }
274
274
  }
@@ -21,7 +21,7 @@ function MapLayerSettingsMenu({ mapLayerSettings, onMenuItemSelection, activeVie
21
21
  React.useEffect(() => {
22
22
  async function fetchRangeData() {
23
23
  let hasRange = false;
24
- const indexInDisplayStyle = activeViewport?.displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);
24
+ const indexInDisplayStyle = activeViewport === null || activeViewport === void 0 ? void 0 : activeViewport.displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);
25
25
  if (undefined !== indexInDisplayStyle) {
26
26
  hasRange = (undefined !== await activeViewport.displayStyle.getMapLayerRange(indexInDisplayStyle, mapLayerSettings.isOverlay));
27
27
  }
@@ -44,12 +44,13 @@ function MapLayerSettingsMenu({ mapLayerSettings, onMenuItemSelection, activeVie
44
44
  onMenuItemSelection("zoom-to-layer", mapLayerSettings);
45
45
  }, [setIsSettingsOpen, onMenuItemSelection, mapLayerSettings]);
46
46
  const applyTransparencyChange = React.useCallback((value) => {
47
+ var _a;
47
48
  if (activeViewport) {
48
49
  const newTransparency = value;
49
50
  const displayStyle = activeViewport.displayStyle;
50
51
  const indexInDisplayStyle = displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);
51
52
  if (-1 !== indexInDisplayStyle) {
52
- const styleTransparency = displayStyle.mapLayerAtIndex(indexInDisplayStyle, mapLayerSettings.isOverlay)?.transparency;
53
+ const styleTransparency = (_a = displayStyle.mapLayerAtIndex(indexInDisplayStyle, mapLayerSettings.isOverlay)) === null || _a === void 0 ? void 0 : _a.transparency;
53
54
  const styleTransparencyValue = styleTransparency ? styleTransparency : 0;
54
55
  if (Math.abs(styleTransparencyValue - newTransparency) > 0.01) {
55
56
  // update the display style
@@ -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,EAA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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,kDAAiE;AACjE,wDAAsD;AACtD,kCAAgC;AAEhC,+CAA8C;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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":["/*---------------------------------------------------------------------------------------------\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"]}
@@ -45,11 +45,11 @@ function MapLayerSettingsPopupButton(props) {
45
45
  return;
46
46
  }
47
47
  // If clicking on button that open panel - don't trigger outside click processing
48
- if (buttonRef?.current && buttonRef?.current.contains(event.target)) {
48
+ if ((buttonRef === null || buttonRef === void 0 ? void 0 : buttonRef.current) && (buttonRef === null || buttonRef === void 0 ? void 0 : buttonRef.current.contains(event.target))) {
49
49
  return;
50
50
  }
51
51
  // If clicking the panel, this is not an outside clicked
52
- if (panelRef.current && panelRef?.current.contains(event.target)) {
52
+ if (panelRef.current && (panelRef === null || panelRef === void 0 ? void 0 : panelRef.current.contains(event.target))) {
53
53
  return;
54
54
  }
55
55
  // If we reach this point, we got an outside clicked, no close the popup
@@ -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,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,MA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C,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,6DAA0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B,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"]}
@@ -15,11 +15,11 @@ function MapLayersWidget(props) {
15
15
  const [notGeoLocatedMsg] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.NotSupported"));
16
16
  const activeViewport = (0, appui_react_1.useActiveViewport)();
17
17
  const ref = React.useRef(null);
18
- const [isGeoLocated, setIsGeoLocated] = React.useState(!!activeViewport?.iModel.isGeoLocated);
18
+ const [isGeoLocated, setIsGeoLocated] = React.useState(!!(activeViewport === null || activeViewport === void 0 ? void 0 : activeViewport.iModel.isGeoLocated));
19
19
  React.useEffect(() => {
20
- const updateIsGeoLocated = () => setIsGeoLocated(!!activeViewport?.iModel.isGeoLocated);
21
- return activeViewport?.iModel.onEcefLocationChanged.addListener(updateIsGeoLocated);
22
- }, [activeViewport?.iModel]);
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
23
  if (activeViewport && isGeoLocated && activeViewport.view.isSpatialView())
24
24
  return (React.createElement("div", { ref: ref, className: "map-manager-layer-host" },
25
25
  React.createElement(MapLayerManager_1.MapLayerManager, { activeViewport: activeViewport, mapLayerOptions: props.mapLayerOptions, getContainerForClone: () => {
@@ -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,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,MAAM,CAAC,YAAY,CAAA,CAAC,CAAC;IAE9F,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,kBAAkB,GAAG,GAAG,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,MAAM,CAAC,YAAY,CAAA,CAAC,CAAC;QACxF,OAAO,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,MAAM,CAAC,qBAAqB,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;IACtF,CAAC,EAAE,CAAC,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,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"]}
@@ -26,30 +26,34 @@ exports.MAP_TYPES = {
26
26
  };
27
27
  // eslint-disable-next-line @typescript-eslint/naming-convention
28
28
  function MapUrlDialog(props) {
29
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
29
30
  const { isOverlay, onOkResult, mapTypesOptions } = props;
30
31
  const getMapUrlFromProps = React.useCallback(() => {
32
+ var _a;
31
33
  if (props.mapLayerSourceToEdit) {
32
34
  return props.mapLayerSourceToEdit.url;
33
35
  }
34
- else if (props.layerRequiringCredentials?.url) {
36
+ else if ((_a = props.layerRequiringCredentials) === null || _a === void 0 ? void 0 : _a.url) {
35
37
  return props.layerRequiringCredentials.url;
36
38
  }
37
39
  return "";
38
40
  }, [props.layerRequiringCredentials, props.mapLayerSourceToEdit]);
39
41
  const getMapNameFromProps = React.useCallback(() => {
42
+ var _a;
40
43
  if (props.mapLayerSourceToEdit) {
41
44
  return props.mapLayerSourceToEdit.name;
42
45
  }
43
- else if (props.layerRequiringCredentials?.name) {
46
+ else if ((_a = props.layerRequiringCredentials) === null || _a === void 0 ? void 0 : _a.name) {
44
47
  return props.layerRequiringCredentials.name;
45
48
  }
46
49
  return "";
47
50
  }, [props.layerRequiringCredentials, props.mapLayerSourceToEdit]);
48
51
  const getFormatFromProps = React.useCallback(() => {
52
+ var _a;
49
53
  if (props.mapLayerSourceToEdit) {
50
54
  return props.mapLayerSourceToEdit.formatId;
51
55
  }
52
- else if (props.layerRequiringCredentials?.formatId) {
56
+ else if ((_a = props.layerRequiringCredentials) === null || _a === void 0 ? void 0 : _a.formatId) {
53
57
  return props.layerRequiringCredentials.formatId;
54
58
  }
55
59
  return undefined;
@@ -89,7 +93,7 @@ function MapUrlDialog(props) {
89
93
  const [onOauthProcessEnd] = React.useState(new core_bentley_1.BeEvent());
90
94
  const [accessClient, setAccessClient] = React.useState();
91
95
  const [isAccessClientInitialized, setAccessClientInitialized] = React.useState(false);
92
- const [mapType, setMapType] = React.useState(getFormatFromProps() ?? "ArcGIS");
96
+ const [mapType, setMapType] = React.useState((_a = getFormatFromProps()) !== null && _a !== void 0 ? _a : "ArcGIS");
93
97
  // 'isMounted' is used to prevent any async operation once the hook has been
94
98
  // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.
95
99
  const isMounted = React.useRef(false);
@@ -99,19 +103,20 @@ function MapUrlDialog(props) {
99
103
  isMounted.current = false;
100
104
  };
101
105
  }, []);
102
- const [isSettingsStorageAvailable] = React.useState(mapLayers_1.MapLayersUI.iTwinConfig && props?.activeViewport?.iModel?.iTwinId);
103
- const [hasImodelContext] = React.useState(props?.activeViewport?.iModel?.iTwinId !== undefined
106
+ const [isSettingsStorageAvailable] = React.useState(mapLayers_1.MapLayersUI.iTwinConfig && ((_c = (_b = props === null || props === void 0 ? void 0 : props.activeViewport) === null || _b === void 0 ? void 0 : _b.iModel) === null || _c === void 0 ? void 0 : _c.iTwinId));
107
+ const [hasImodelContext] = React.useState(((_e = (_d = props === null || props === void 0 ? void 0 : props.activeViewport) === null || _d === void 0 ? void 0 : _d.iModel) === null || _e === void 0 ? void 0 : _e.iTwinId) !== undefined
104
108
  && props.activeViewport.iModel.iTwinId !== core_bentley_1.Guid.empty
105
- && props?.activeViewport?.iModel?.iModelId !== undefined
106
- && props?.activeViewport.iModel.iModelId !== core_bentley_1.Guid.empty);
109
+ && ((_g = (_f = props === null || props === void 0 ? void 0 : props.activeViewport) === null || _f === void 0 ? void 0 : _f.iModel) === null || _g === void 0 ? void 0 : _g.iModelId) !== undefined
110
+ && (props === null || props === void 0 ? void 0 : props.activeViewport.iModel.iModelId) !== core_bentley_1.Guid.empty);
107
111
  // Even though the settings storage is available,
108
112
  // we don't always want to enable it in the UI.
109
113
  const [settingsStorageDisabled] = React.useState(!isSettingsStorageAvailable || props.mapLayerSourceToEdit !== undefined || props.layerRequiringCredentials !== undefined);
110
114
  const [layerRequiringCredentialsIdx] = React.useState(() => {
115
+ var _a;
111
116
  if (props.layerRequiringCredentials === undefined || !props.layerRequiringCredentials.name || !props.layerRequiringCredentials.url) {
112
117
  return undefined;
113
118
  }
114
- const indexInDisplayStyle = props.activeViewport?.displayStyle.findMapLayerIndexByNameAndSource(props.layerRequiringCredentials.name, props.layerRequiringCredentials.url, isOverlay);
119
+ const indexInDisplayStyle = (_a = props.activeViewport) === null || _a === void 0 ? void 0 : _a.displayStyle.findMapLayerIndexByNameAndSource(props.layerRequiringCredentials.name, props.layerRequiringCredentials.url, isOverlay);
115
120
  if (indexInDisplayStyle === undefined || indexInDisplayStyle < 0) {
116
121
  return undefined;
117
122
  }
@@ -171,7 +176,7 @@ function MapUrlDialog(props) {
171
176
  return sourceRequireAuth || invalidCredentials;
172
177
  }, [accessClient, invalidCredentialsProvided]);
173
178
  const updateAttachedLayer = React.useCallback(async (source, validation) => {
174
- const vp = props?.activeViewport;
179
+ const vp = props === null || props === void 0 ? void 0 : props.activeViewport;
175
180
  if (vp === undefined || source === undefined || layerRequiringCredentialsIdx === undefined) {
176
181
  const error = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachMissingViewOrSource");
177
182
  const msg = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachError", { error, sourceUrl: source.url });
@@ -186,7 +191,7 @@ function MapUrlDialog(props) {
186
191
  // Either initial attach/initialize failed or the layer failed to load at least one tile
187
192
  // because of an invalid token; in both cases tile tree needs to be fully reset
188
193
  const provider = vp.getMapLayerImageryProvider(layerRequiringCredentialsIdx, isOverlay);
189
- provider?.resetStatus();
194
+ provider === null || provider === void 0 ? void 0 : provider.resetStatus();
190
195
  vp.resetMapLayer(layerRequiringCredentialsIdx, isOverlay);
191
196
  vp.invalidateRenderPlan();
192
197
  // This handler will close the layer source handler, and therefore the MapUrl dialog.
@@ -196,7 +201,7 @@ function MapUrlDialog(props) {
196
201
  }, [isOverlay, layerRequiringCredentialsIdx, onOkResult, props.activeViewport]);
197
202
  // Returns true if no further input is needed from end-user.
198
203
  const doAttach = React.useCallback(async (source, validation) => {
199
- const vp = props?.activeViewport;
204
+ const vp = props === null || props === void 0 ? void 0 : props.activeViewport;
200
205
  if (vp === undefined || source === undefined) {
201
206
  const error = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachMissingViewOrSource");
202
207
  const msg = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachError", { error, sourceUrl: source.url });
@@ -233,7 +238,7 @@ function MapUrlDialog(props) {
233
238
  // don't call it if the dialog needs to remains open.
234
239
  onOkResult();
235
240
  return true;
236
- }, [hasImodelContext, isOverlay, onOkResult, props?.activeViewport, props.layerRequiringCredentials, settingsStorage, settingsStorageDisabled]);
241
+ }, [hasImodelContext, isOverlay, onOkResult, props === null || props === void 0 ? void 0 : props.activeViewport, props.layerRequiringCredentials, settingsStorage, settingsStorageDisabled]);
237
242
  // Validate the layer source and attempt to attach (or update) the layer.
238
243
  // Returns true if no further input is needed from end-user (i.e. close the dialog)
239
244
  const attemptAttachSource = React.useCallback(async (source) => {
@@ -312,12 +317,13 @@ function MapUrlDialog(props) {
312
317
  if (props.mapLayerSourceToEdit !== undefined) {
313
318
  const vp = props.activeViewport;
314
319
  void (async () => {
315
- if (isSettingsStorageAvailable && vp?.iModel?.iTwinId) {
320
+ var _a, _b;
321
+ if (isSettingsStorageAvailable && ((_a = vp === null || vp === void 0 ? void 0 : vp.iModel) === null || _a === void 0 ? void 0 : _a.iTwinId)) {
316
322
  try {
317
- await MapLayerPreferences_1.MapLayerPreferences.replaceSource(props.mapLayerSourceToEdit, source, vp.iModel.iTwinId, vp?.iModel.iModelId);
323
+ await MapLayerPreferences_1.MapLayerPreferences.replaceSource(props.mapLayerSourceToEdit, source, vp.iModel.iTwinId, vp === null || vp === void 0 ? void 0 : vp.iModel.iModelId);
318
324
  }
319
325
  catch (err) {
320
- const errorMessage = core_frontend_1.IModelApp.localization.getLocalizedString("mapLayers:Messages.MapLayerEditError", { layerName: props.mapLayerSourceToEdit?.name });
326
+ const errorMessage = core_frontend_1.IModelApp.localization.getLocalizedString("mapLayers:Messages.MapLayerEditError", { layerName: (_b = props.mapLayerSourceToEdit) === null || _b === void 0 ? void 0 : _b.name });
321
327
  core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Error, errorMessage));
322
328
  return;
323
329
  }
@@ -353,13 +359,13 @@ function MapUrlDialog(props) {
353
359
  };
354
360
  // Currently only arcgis support AccessClient
355
361
  const ac = core_frontend_1.IModelApp.mapLayerFormatRegistry.getAccessClient(exports.MAP_TYPES.arcGis);
356
- if (ac?.onOAuthProcessEnd) {
362
+ if (ac === null || ac === void 0 ? void 0 : ac.onOAuthProcessEnd) {
357
363
  setAccessClient(ac); // cache it, so we dont need to make another lookup;
358
364
  ac.onOAuthProcessEnd.addListener(handleOAuthProcessEnd);
359
365
  }
360
366
  setAccessClientInitialized(true);
361
367
  return () => {
362
- if (ac?.onOAuthProcessEnd) {
368
+ if (ac === null || ac === void 0 ? void 0 : ac.onOAuthProcessEnd) {
363
369
  ac.onOAuthProcessEnd.removeListener(handleOAuthProcessEnd);
364
370
  }
365
371
  setAccessClient(undefined);
@@ -381,7 +387,8 @@ function MapUrlDialog(props) {
381
387
  React.useEffect(() => {
382
388
  // Attach source asynchronously.
383
389
  void (async () => {
384
- if (isAccessClientInitialized && props.layerRequiringCredentials?.url !== undefined && props.layerRequiringCredentials?.name !== undefined) {
390
+ var _a, _b;
391
+ if (isAccessClientInitialized && ((_a = props.layerRequiringCredentials) === null || _a === void 0 ? void 0 : _a.url) !== undefined && ((_b = props.layerRequiringCredentials) === null || _b === void 0 ? void 0 : _b.name) !== undefined) {
385
392
  try {
386
393
  const source = core_frontend_1.MapLayerSource.fromJSON({
387
394
  url: props.layerRequiringCredentials.url,
@@ -400,11 +407,7 @@ function MapUrlDialog(props) {
400
407
  catch (_error) { }
401
408
  }
402
409
  })();
403
- }, [isAccessClientInitialized,
404
- props.layerRequiringCredentials?.formatId,
405
- props.layerRequiringCredentials?.name,
406
- props.layerRequiringCredentials?.url,
407
- updateAuthState]);
410
+ }, [isAccessClientInitialized, (_h = props.layerRequiringCredentials) === null || _h === void 0 ? void 0 : _h.formatId, (_j = props.layerRequiringCredentials) === null || _j === void 0 ? void 0 : _j.name, (_k = props.layerRequiringCredentials) === null || _k === void 0 ? void 0 : _k.url, updateAuthState]);
408
411
  const dialogContainer = React.useRef(null);
409
412
  const readyToSave = React.useCallback(() => {
410
413
  const credentialsSet = !!userName && !!password;