@itwin/map-layers 3.4.0-dev.9 → 3.5.0-dev.4

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 (64) hide show
  1. package/CHANGELOG.md +25 -1
  2. package/lib/cjs/ui/MapFeatureInfoTool.d.ts.map +1 -1
  3. package/lib/cjs/ui/MapFeatureInfoTool.js.map +1 -1
  4. package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts +1 -0
  5. package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
  6. package/lib/cjs/ui/widget/AttachLayerPopupButton.js +2 -2
  7. package/lib/cjs/ui/widget/AttachLayerPopupButton.js.map +1 -1
  8. package/lib/cjs/ui/widget/BasemapPanel.d.ts +5 -1
  9. package/lib/cjs/ui/widget/BasemapPanel.d.ts.map +1 -1
  10. package/lib/cjs/ui/widget/BasemapPanel.js +22 -11
  11. package/lib/cjs/ui/widget/BasemapPanel.js.map +1 -1
  12. package/lib/cjs/ui/widget/MapLayerDroppable.d.ts +1 -0
  13. package/lib/cjs/ui/widget/MapLayerDroppable.d.ts.map +1 -1
  14. package/lib/cjs/ui/widget/MapLayerDroppable.js +6 -6
  15. package/lib/cjs/ui/widget/MapLayerDroppable.js.map +1 -1
  16. package/lib/cjs/ui/widget/MapLayerManager.d.ts.map +1 -1
  17. package/lib/cjs/ui/widget/MapLayerManager.js +14 -6
  18. package/lib/cjs/ui/widget/MapLayerManager.js.map +1 -1
  19. package/lib/cjs/ui/widget/MapLayerManager.scss +6 -0
  20. package/lib/cjs/ui/widget/MapLayerSettingsMenu.d.ts +5 -2
  21. package/lib/cjs/ui/widget/MapLayerSettingsMenu.d.ts.map +1 -1
  22. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js +2 -2
  23. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  24. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.d.ts +4 -1
  25. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.d.ts.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/TransparencyPopupButton.d.ts +2 -1
  29. package/lib/cjs/ui/widget/TransparencyPopupButton.d.ts.map +1 -1
  30. package/lib/cjs/ui/widget/TransparencyPopupButton.js +3 -3
  31. package/lib/cjs/ui/widget/TransparencyPopupButton.js.map +1 -1
  32. package/lib/cjs/ui/widget/TransparencyPopupButton.scss +11 -7
  33. package/lib/esm/ui/MapFeatureInfoTool.d.ts.map +1 -1
  34. package/lib/esm/ui/MapFeatureInfoTool.js.map +1 -1
  35. package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts +1 -0
  36. package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
  37. package/lib/esm/ui/widget/AttachLayerPopupButton.js +2 -2
  38. package/lib/esm/ui/widget/AttachLayerPopupButton.js.map +1 -1
  39. package/lib/esm/ui/widget/BasemapPanel.d.ts +5 -1
  40. package/lib/esm/ui/widget/BasemapPanel.d.ts.map +1 -1
  41. package/lib/esm/ui/widget/BasemapPanel.js +22 -11
  42. package/lib/esm/ui/widget/BasemapPanel.js.map +1 -1
  43. package/lib/esm/ui/widget/MapLayerDroppable.d.ts +1 -0
  44. package/lib/esm/ui/widget/MapLayerDroppable.d.ts.map +1 -1
  45. package/lib/esm/ui/widget/MapLayerDroppable.js +6 -6
  46. package/lib/esm/ui/widget/MapLayerDroppable.js.map +1 -1
  47. package/lib/esm/ui/widget/MapLayerManager.d.ts.map +1 -1
  48. package/lib/esm/ui/widget/MapLayerManager.js +14 -6
  49. package/lib/esm/ui/widget/MapLayerManager.js.map +1 -1
  50. package/lib/esm/ui/widget/MapLayerManager.scss +6 -0
  51. package/lib/esm/ui/widget/MapLayerSettingsMenu.d.ts +5 -2
  52. package/lib/esm/ui/widget/MapLayerSettingsMenu.d.ts.map +1 -1
  53. package/lib/esm/ui/widget/MapLayerSettingsMenu.js +2 -2
  54. package/lib/esm/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  55. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.d.ts +4 -1
  56. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.d.ts.map +1 -1
  57. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js +2 -2
  58. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  59. package/lib/esm/ui/widget/TransparencyPopupButton.d.ts +2 -1
  60. package/lib/esm/ui/widget/TransparencyPopupButton.d.ts.map +1 -1
  61. package/lib/esm/ui/widget/TransparencyPopupButton.js +3 -3
  62. package/lib/esm/ui/widget/TransparencyPopupButton.js.map +1 -1
  63. package/lib/esm/ui/widget/TransparencyPopupButton.scss +11 -7
  64. package/package.json +29 -29
@@ -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,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAA6D,MAAM,oBAAoB,CAAC;AACtH,OAAO,EACL,kBAAkB,EAAE,SAAS,EAA2C,eAAe,EAAE,oBAAoB,EAAE,qBAAqB,GAErI,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAc,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAE1F,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAA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AAC,cAAc,EACpC,kBAAkB,EAAE,yBAAyB,EAC7C,6BAA6B,EAAE,2BAA2B,EAC1D,YAAY,EAAE,sBAAsB,GAAI,CACtC,CACU,CAEf,CACoB,CAC9B,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n// cSpell:ignore droppable Sublayer Basemap\r\n\r\n// the following quiet warning caused by react-beautiful-dnd package\r\n/* eslint-disable @typescript-eslint/unbound-method */\r\n\r\nimport { assert, BentleyError } from \"@itwin/core-bentley\";\r\nimport { ImageMapLayerSettings, MapImagerySettings, MapSubLayerProps, MapSubLayerSettings } from \"@itwin/core-common\";\r\nimport {\r\n ImageryMapTileTree, IModelApp, MapLayerImageryProvider, MapLayerSource, MapLayerSources, NotifyMessageDetails, OutputMessagePriority,\r\n ScreenViewport, TileTreeOwner, Viewport,\r\n} from \"@itwin/core-frontend\";\r\nimport { ToggleSwitch } from \"@itwin/itwinui-react\";\r\nimport * as React from \"react\";\r\nimport { DragDropContext, DropResult } from \"react-beautiful-dnd\";\r\nimport { MapLayerPreferences, MapLayerSourceChangeType } from \"../../MapLayerPreferences\";\r\nimport { MapLayerOptions, StyleMapLayerSettings } from \"../Interfaces\";\r\nimport { AttachLayerPopupButton } from \"./AttachLayerPopupButton\";\r\nimport { BasemapPanel } from \"./BasemapPanel\";\r\nimport { MapLayerDroppable } from \"./MapLayerDroppable\";\r\nimport \"./MapLayerManager.scss\";\r\nimport { MapLayerSettingsPopupButton } from \"./MapLayerSettingsPopupButton\";\r\nimport { MapLayersUI } from \"../../mapLayers\";\r\n\r\n/** @internal */\r\nexport interface SourceMapContextProps {\r\n readonly sources: MapLayerSource[];\r\n readonly loadingSources: boolean;\r\n readonly bases: MapLayerSource[];\r\n readonly refreshFromStyle: () => void;\r\n readonly activeViewport?: ScreenViewport;\r\n readonly backgroundLayers?: StyleMapLayerSettings[];\r\n readonly overlayLayers?: StyleMapLayerSettings[];\r\n readonly mapLayerOptions?: MapLayerOptions;\r\n}\r\n\r\n/** @internal */\r\nexport const SourceMapContext = React.createContext<SourceMapContextProps>({ // eslint-disable-line @typescript-eslint/naming-convention\r\n sources: [],\r\n loadingSources: false,\r\n bases: [],\r\n refreshFromStyle: () => { },\r\n});\r\n\r\n/** @internal */\r\nexport function useSourceMapContext(): SourceMapContextProps {\r\n return React.useContext(SourceMapContext);\r\n}\r\n\r\nfunction getSubLayerProps(subLayerSettings: MapSubLayerSettings[]): MapSubLayerProps[] {\r\n return subLayerSettings.map((subLayer) => subLayer.toJSON());\r\n}\r\n\r\nfunction getMapLayerSettingsFromViewport(viewport: Viewport, getBackgroundMap: boolean, populateSubLayers = true): StyleMapLayerSettings[] | undefined {\r\n const displayStyle = viewport.displayStyle;\r\n if (!displayStyle)\r\n return undefined;\r\n\r\n const layers = new Array<StyleMapLayerSettings>();\r\n\r\n const displayStyleLayers = (getBackgroundMap ? displayStyle.backgroundMapLayers : displayStyle.overlayMapLayers);\r\n for (let layerIdx = 0; layerIdx < displayStyleLayers.length; layerIdx++) {\r\n const layerSettings = displayStyleLayers[layerIdx];\r\n const isOverlay = !getBackgroundMap;\r\n const layerProvider = viewport.getMapLayerImageryProvider(layerIdx, isOverlay);\r\n const popSubLayers = populateSubLayers && (layerSettings instanceof ImageMapLayerSettings);\r\n layers.push({\r\n visible: layerSettings.visible,\r\n name: layerSettings.name,\r\n source: layerSettings.source,\r\n transparency: layerSettings.transparency,\r\n transparentBackground: layerSettings.transparentBackground,\r\n subLayers: popSubLayers ? getSubLayerProps(layerSettings.subLayers) : undefined,\r\n showSubLayers: false,\r\n isOverlay,\r\n provider: layerProvider,\r\n });\r\n }\r\n\r\n // since we want to display higher level maps above lower maps in UI reverse their order here.\r\n return layers.reverse();\r\n}\r\n\r\ninterface MapLayerManagerProps {\r\n getContainerForClone: () => HTMLElement;\r\n activeViewport: ScreenViewport;\r\n mapLayerOptions?: MapLayerOptions;\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function MapLayerManager(props: MapLayerManagerProps) {\r\n const [mapSources, setMapSources] = React.useState<MapLayerSource[] | undefined>();\r\n const [loadingSources, setLoadingSources] = React.useState(false);\r\n const [baseSources, setBaseSources] = React.useState<MapLayerSource[] | undefined>();\r\n const [overlaysLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.OverlayLayers\"));\r\n const [underlaysLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.BackgroundLayers\"));\r\n const { activeViewport, mapLayerOptions } = props;\r\n const hideExternalMapLayersSection = mapLayerOptions?.hideExternalMapLayers ? mapLayerOptions.hideExternalMapLayers : false;\r\n const fetchPublicMapLayerSources = mapLayerOptions?.fetchPublicMapLayerSources ? mapLayerOptions.fetchPublicMapLayerSources : false;\r\n\r\n // map layer settings from display style\r\n const [backgroundMapLayers, setBackgroundMapLayers] = React.useState<StyleMapLayerSettings[] | undefined>(getMapLayerSettingsFromViewport(activeViewport, true));\r\n const [overlayMapLayers, setOverlayMapLayers] = React.useState<StyleMapLayerSettings[] | undefined>(getMapLayerSettingsFromViewport(activeViewport, false));\r\n\r\n const loadMapLayerSettingsFromViewport = React.useCallback((viewport: Viewport) => {\r\n setBackgroundMapLayers(getMapLayerSettingsFromViewport(viewport, true));\r\n setOverlayMapLayers(getMapLayerSettingsFromViewport(viewport, false));\r\n }, [setBackgroundMapLayers, setOverlayMapLayers]);\r\n\r\n const [backgroundMapVisible, setBackgroundMapVisible] = React.useState(() => {\r\n if (activeViewport) {\r\n return activeViewport.viewFlags.backgroundMap;\r\n }\r\n return false;\r\n });\r\n\r\n // 'isMounted' is used to prevent any async operation once the hook has been\r\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\r\n const isMounted = React.useRef(false);\r\n React.useEffect(() => {\r\n isMounted.current = true;\r\n return () => {\r\n isMounted.current = false;\r\n };\r\n });\r\n\r\n // Setup onTileTreeLoad events listening.\r\n // This is needed because we need to know when the imagery provider\r\n // is created, and be able to monitor to status change.\r\n React.useEffect(() => {\r\n const handleTileTreeLoad = (args: TileTreeOwner) => {\r\n\r\n // Ignore non-map tile trees\r\n if (args.tileTree instanceof ImageryMapTileTree) {\r\n loadMapLayerSettingsFromViewport(activeViewport);\r\n }\r\n };\r\n\r\n IModelApp.tileAdmin.onTileTreeLoad.addListener(handleTileTreeLoad);\r\n\r\n return () => {\r\n IModelApp.tileAdmin.onTileTreeLoad.removeListener(handleTileTreeLoad);\r\n };\r\n\r\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\r\n\r\n // Setup onMapImageryChanged events listening.\r\n\r\n React.useEffect(() => {\r\n const handleMapImageryChanged = (args: Readonly<MapImagerySettings>) => {\r\n\r\n if (args.backgroundLayers.length !== (backgroundMapLayers ? backgroundMapLayers.length : 0)\r\n || args.overlayLayers.length !== (overlayMapLayers ? overlayMapLayers.length : 0)) {\r\n loadMapLayerSettingsFromViewport(activeViewport);\r\n }\r\n };\r\n activeViewport?.displayStyle.settings.onMapImageryChanged.addListener(handleMapImageryChanged);\r\n\r\n return () => {\r\n activeViewport?.displayStyle.settings.onMapImageryChanged.removeListener(handleMapImageryChanged);\r\n };\r\n }, [activeViewport, backgroundMapLayers, loadMapLayerSettingsFromViewport, overlayMapLayers]);\r\n\r\n const handleProviderStatusChanged = React.useCallback((_args: MapLayerImageryProvider) => {\r\n loadMapLayerSettingsFromViewport(activeViewport);\r\n }, [loadMapLayerSettingsFromViewport, activeViewport]);\r\n\r\n // Triggered whenever a provider status change\r\n React.useEffect(() => {\r\n backgroundMapLayers?.forEach((layer) => { layer.provider?.onStatusChanged.addListener(handleProviderStatusChanged); });\r\n overlayMapLayers?.forEach((layer) => { layer.provider?.onStatusChanged.addListener(handleProviderStatusChanged); });\r\n\r\n return () => {\r\n backgroundMapLayers?.forEach((layer) => { layer.provider?.onStatusChanged.removeListener(handleProviderStatusChanged); });\r\n overlayMapLayers?.forEach((layer) => { layer.provider?.onStatusChanged.removeListener(handleProviderStatusChanged); });\r\n };\r\n\r\n }, [backgroundMapLayers, overlayMapLayers, activeViewport, loadMapLayerSettingsFromViewport, handleProviderStatusChanged]);\r\n\r\n React.useEffect(() => {\r\n async function fetchWmsMapData() {\r\n const sources: MapLayerSource[] = [];\r\n const bases: MapLayerSource[] = [];\r\n const sourceLayers = await MapLayerSources.create(undefined, (fetchPublicMapLayerSources && !hideExternalMapLayersSection));\r\n\r\n const iModel = IModelApp.viewManager.selectedView ? IModelApp.viewManager.selectedView.iModel : undefined;\r\n try {\r\n const preferenceSources = ( iModel?.iTwinId === undefined\r\n ? []\r\n : await MapLayerPreferences.getSources(iModel?.iTwinId, iModel?.iModelId)\r\n );\r\n for (const source of preferenceSources)\r\n await MapLayerSources.addSourceToMapLayerSources(source);\r\n } catch (err) {\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.ErrorLoadingLayers\"), BentleyError.getErrorMessage(err)));\r\n }\r\n\r\n if (!isMounted.current) {\r\n return;\r\n }\r\n\r\n // This is where the list of layers first gets populated... I need to update it\r\n // MapUrlDialog gets around knowing MapLayerManager exists and vice versa by affecting the viewports displayStyle which MapLayerManager is listening for\r\n // We know when displayStyle changes we've added a layer, this layer may not be a custom layer\r\n sourceLayers?.layers.forEach((source: MapLayerSource) => { sources.push(source); });\r\n setMapSources(sources);\r\n sourceLayers?.bases.forEach((source: MapLayerSource) => { bases.push(source); });\r\n setBaseSources(bases);\r\n }\r\n\r\n setLoadingSources(true);\r\n fetchWmsMapData().then(() => {\r\n if (isMounted.current) {\r\n setLoadingSources(false);\r\n }\r\n\r\n }).catch(() => {\r\n if (isMounted.current) {\r\n setLoadingSources(false);\r\n }\r\n });\r\n }, [setMapSources, fetchPublicMapLayerSources, hideExternalMapLayersSection]);\r\n\r\n const updateMapSources = React.useCallback(() => {\r\n const newSources: MapLayerSource[] = [];\r\n MapLayerSources.getInstance()?.layers?.forEach((sourceLayer: MapLayerSource) => { newSources.push(sourceLayer); });\r\n setMapSources(newSources);\r\n }, [setMapSources]);\r\n\r\n /**\r\n * Handle change events in the MapLayerPreferences\r\n */\r\n React.useEffect(() => {\r\n const handleLayerSourceChange = async (changeType: MapLayerSourceChangeType, oldSource?: MapLayerSource, newSource?: MapLayerSource) => {\r\n const removeSourceOnly = (changeType === MapLayerSourceChangeType.Removed);\r\n const removeSource = (changeType === MapLayerSourceChangeType.Replaced || changeType === MapLayerSourceChangeType.Removed);\r\n const addSource = (changeType === MapLayerSourceChangeType.Replaced || changeType === MapLayerSourceChangeType.Added);\r\n\r\n if (removeSource) {\r\n if (oldSource) {\r\n const succeeded = MapLayerSources.removeLayerByName(oldSource.name);\r\n assert(succeeded);\r\n if (!succeeded) {\r\n return;\r\n }\r\n\r\n if (removeSourceOnly) {\r\n updateMapSources();\r\n return;\r\n }\r\n }\r\n }\r\n\r\n if (addSource) {\r\n const sources = await MapLayerSources.addSourceToMapLayerSources(newSource);\r\n assert(sources !== undefined);\r\n if (sources) {\r\n updateMapSources();\r\n }\r\n }\r\n };\r\n MapLayerPreferences.onLayerSourceChanged.addListener(handleLayerSourceChange);\r\n return (() => {\r\n MapLayerPreferences.onLayerSourceChanged.removeListener(handleLayerSourceChange);\r\n });\r\n }, [updateMapSources]);\r\n\r\n // update when a different display style is loaded.\r\n React.useEffect(() => {\r\n const handleDisplayStyleChange = (vp: Viewport) => {\r\n loadMapLayerSettingsFromViewport(vp);\r\n };\r\n activeViewport?.onDisplayStyleChanged.addListener(handleDisplayStyleChange);\r\n return () => {\r\n activeViewport?.onDisplayStyleChanged.removeListener(handleDisplayStyleChange);\r\n };\r\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\r\n\r\n const handleOnMenuItemSelection = React.useCallback((action: string, mapLayerSettings: StyleMapLayerSettings) => {\r\n if (!activeViewport || !activeViewport.displayStyle)\r\n return;\r\n\r\n const indexInDisplayStyle = activeViewport.displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);\r\n if (indexInDisplayStyle < 0)\r\n return;\r\n\r\n switch (action) {\r\n case \"delete\":\r\n activeViewport.displayStyle.detachMapLayerByIndex(indexInDisplayStyle, mapLayerSettings.isOverlay);\r\n break;\r\n case \"zoom-to-layer\":\r\n activeViewport.displayStyle.viewMapLayerRange(indexInDisplayStyle, mapLayerSettings.isOverlay, activeViewport).then((status) => {\r\n if (!status) {\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.NoRangeDefined\");\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, `${msg} [${mapLayerSettings.name}]`));\r\n }\r\n }).catch((_error) => { });\r\n break;\r\n }\r\n activeViewport.invalidateRenderPlan();\r\n\r\n // force UI to update\r\n loadMapLayerSettingsFromViewport(activeViewport);\r\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\r\n\r\n const handleLayerVisibilityChange = React.useCallback((mapLayerSettings: StyleMapLayerSettings) => {\r\n if (activeViewport) {\r\n const isVisible = !mapLayerSettings.visible;\r\n\r\n const displayStyle = activeViewport.displayStyle;\r\n const indexInDisplayStyle = displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);\r\n if (-1 !== indexInDisplayStyle) {\r\n // update the display style\r\n displayStyle.changeMapLayerProps({ visible: isVisible }, indexInDisplayStyle, mapLayerSettings.isOverlay);\r\n activeViewport.invalidateRenderPlan();\r\n\r\n // force UI to update\r\n loadMapLayerSettingsFromViewport(activeViewport);\r\n }\r\n }\r\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\r\n\r\n const handleMapLayersToggle = React.useCallback(() => {\r\n if (activeViewport) {\r\n const newState = !backgroundMapVisible;\r\n activeViewport.viewFlags = activeViewport.viewFlags.with(\"backgroundMap\", newState);\r\n setBackgroundMapVisible(newState);\r\n }\r\n }, [backgroundMapVisible, setBackgroundMapVisible, activeViewport]);\r\n\r\n const handleOnMapLayerDragEnd = React.useCallback((result: DropResult /* , _provided: ResponderProvided*/) => {\r\n const { destination, source } = result;\r\n\r\n if (!destination) // dropped outside of list\r\n return;\r\n\r\n // item was not moved\r\n if (destination.droppableId === source.droppableId && destination.index === source.index)\r\n return;\r\n\r\n let fromMapLayer: StyleMapLayerSettings | undefined;\r\n if (source.droppableId === \"overlayMapLayers\" && overlayMapLayers)\r\n fromMapLayer = overlayMapLayers[source.index];\r\n else if (source.droppableId === \"backgroundMapLayers\" && backgroundMapLayers)\r\n fromMapLayer = backgroundMapLayers[source.index];\r\n\r\n if (!fromMapLayer || !activeViewport)\r\n return;\r\n\r\n const displayStyle = activeViewport.displayStyle;\r\n let toMapLayer: StyleMapLayerSettings | undefined;\r\n let toIndexInDisplayStyle = -1;\r\n\r\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.\r\n // We need to do this because the order of layers in UI are reversed so higher layers appear above lower layers.\r\n if (undefined !== destination.index) {\r\n if (destination.droppableId === \"overlayMapLayers\" && overlayMapLayers)\r\n toMapLayer = overlayMapLayers[destination.index];\r\n else if (destination.droppableId === \"backgroundMapLayers\" && backgroundMapLayers)\r\n toMapLayer = backgroundMapLayers[destination.index];\r\n if (toMapLayer)\r\n toIndexInDisplayStyle = displayStyle.findMapLayerIndexByNameAndSource(toMapLayer.name, toMapLayer.source, toMapLayer.isOverlay);\r\n }\r\n\r\n const fromIndexInDisplayStyle = displayStyle.findMapLayerIndexByNameAndSource(fromMapLayer.name, fromMapLayer.source, fromMapLayer.isOverlay);\r\n if (fromIndexInDisplayStyle < 0)\r\n return;\r\n\r\n if (destination.droppableId !== source.droppableId) {\r\n // see if we moved from \"overlayMapLayers\" to \"backgroundMapLayers\" or vice-versa\r\n const settings = activeViewport.displayStyle.mapLayerAtIndex(fromIndexInDisplayStyle, fromMapLayer.isOverlay);\r\n if (settings) {\r\n activeViewport.displayStyle.detachMapLayerByIndex(fromIndexInDisplayStyle, fromMapLayer.isOverlay);\r\n\r\n // Manually reverse index when moved from one section to the other\r\n if (fromMapLayer.isOverlay && backgroundMapLayers) {\r\n toIndexInDisplayStyle = displayStyle.backgroundMapLayers.length - destination.index;\r\n } else if (!fromMapLayer.isOverlay && overlayMapLayers) {\r\n toIndexInDisplayStyle = overlayMapLayers.length - destination.index;\r\n }\r\n\r\n activeViewport.displayStyle.attachMapLayer({settings, isOverlay:!fromMapLayer.isOverlay, insertIndex:toIndexInDisplayStyle});\r\n }\r\n } else {\r\n if (undefined === destination.index) {\r\n displayStyle.moveMapLayerToBottom(fromIndexInDisplayStyle, destination.droppableId === \"overlayMapLayers\");\r\n } else {\r\n if (toMapLayer) {\r\n if (toIndexInDisplayStyle !== -1)\r\n displayStyle.moveMapLayerToIndex(fromIndexInDisplayStyle, toIndexInDisplayStyle, toMapLayer.isOverlay);\r\n }\r\n }\r\n }\r\n\r\n // apply display style change to view\r\n activeViewport.invalidateRenderPlan();\r\n\r\n // force UI to update\r\n loadMapLayerSettingsFromViewport(activeViewport);\r\n }, [loadMapLayerSettingsFromViewport, activeViewport, overlayMapLayers, backgroundMapLayers]);\r\n\r\n const handleRefreshFromStyle = React.useCallback(() => {\r\n if (activeViewport)\r\n loadMapLayerSettingsFromViewport(activeViewport);\r\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\r\n\r\n const [baseMapPanelLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.BaseMapPanelTitle\"));\r\n\r\n return (\r\n <SourceMapContext.Provider value={{\r\n activeViewport,\r\n loadingSources,\r\n sources: mapSources ? mapSources : [],\r\n bases: baseSources ? baseSources : [],\r\n refreshFromStyle: handleRefreshFromStyle,\r\n backgroundLayers: backgroundMapLayers,\r\n overlayLayers: overlayMapLayers,\r\n mapLayerOptions,\r\n }}>\r\n <div className=\"map-manager-top-header\">\r\n <span className=\"map-manager-header-label\">{baseMapPanelLabel}</span>\r\n <div className=\"map-manager-header-buttons-group\">\r\n <ToggleSwitch className=\"map-manager-toggle\" checked={backgroundMapVisible} onChange={handleMapLayersToggle} />\r\n <MapLayerSettingsPopupButton />\r\n </div>\r\n </div>\r\n\r\n <div className=\"map-manager-container\">\r\n\r\n <div className=\"map-manager-basemap\">\r\n <BasemapPanel />\r\n </div>\r\n {!hideExternalMapLayersSection &&\r\n <DragDropContext onDragEnd={handleOnMapLayerDragEnd}>\r\n <div className=\"map-manager-layer-wrapper\">\r\n <div className=\"map-manager-underlays\" >\r\n <span className=\"map-manager-underlays-label\">{underlaysLabel}</span><AttachLayerPopupButton isOverlay={false} />\r\n </div>\r\n <MapLayerDroppable\r\n isOverlay={false}\r\n layersList={backgroundMapLayers}\r\n mapTypesOptions={props.mapLayerOptions?.mapTypeOptions}\r\n getContainerForClone={props.getContainerForClone as any}\r\n activeViewport={props.activeViewport}\r\n onMenuItemSelected={handleOnMenuItemSelection}\r\n onItemVisibilityToggleClicked={handleLayerVisibilityChange}\r\n onItemEdited={handleRefreshFromStyle} />\r\n </div>\r\n\r\n <div className=\"map-manager-layer-wrapper\">\r\n <div className=\"map-manager-overlays\" >\r\n <span className=\"map-manager-overlays-label\">{overlaysLabel}</span><AttachLayerPopupButton isOverlay={true} />\r\n </div>\r\n <MapLayerDroppable\r\n isOverlay={true}\r\n layersList={overlayMapLayers}\r\n mapTypesOptions={props.mapLayerOptions?.mapTypeOptions}\r\n getContainerForClone={props.getContainerForClone as any}\r\n activeViewport={props.activeViewport}\r\n onMenuItemSelected={handleOnMenuItemSelection}\r\n onItemVisibilityToggleClicked={handleLayerVisibilityChange}\r\n onItemEdited={handleRefreshFromStyle} />\r\n </div>\r\n </DragDropContext>\r\n }\r\n </div >\r\n </SourceMapContext.Provider >\r\n );\r\n}\r\n\r\n"]}
1
+ {"version":3,"file":"MapLayerManager.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerManager.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J,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n// cSpell:ignore droppable Sublayer Basemap\r\n\r\n// the following quiet warning caused by react-beautiful-dnd package\r\n/* eslint-disable @typescript-eslint/unbound-method */\r\n\r\nimport { assert, BentleyError } from \"@itwin/core-bentley\";\r\nimport { ImageMapLayerSettings, MapImagerySettings, MapSubLayerProps, MapSubLayerSettings } from \"@itwin/core-common\";\r\nimport {\r\n ImageryMapTileTree, IModelApp, MapLayerImageryProvider, MapLayerSource, MapLayerSources, NotifyMessageDetails, OutputMessagePriority,\r\n ScreenViewport, TileTreeOwner, Viewport,\r\n} from \"@itwin/core-frontend\";\r\nimport { ToggleSwitch } from \"@itwin/itwinui-react\";\r\nimport * as React from \"react\";\r\nimport { DragDropContext, DropResult } from \"react-beautiful-dnd\";\r\nimport { MapLayerPreferences, MapLayerSourceChangeType } from \"../../MapLayerPreferences\";\r\nimport { MapLayerOptions, StyleMapLayerSettings } from \"../Interfaces\";\r\nimport { AttachLayerPopupButton } from \"./AttachLayerPopupButton\";\r\nimport { BasemapPanel } from \"./BasemapPanel\";\r\nimport { MapLayerDroppable } from \"./MapLayerDroppable\";\r\nimport \"./MapLayerManager.scss\";\r\nimport { MapLayerSettingsPopupButton } from \"./MapLayerSettingsPopupButton\";\r\nimport { MapLayersUI } from \"../../mapLayers\";\r\n\r\n/** @internal */\r\nexport interface SourceMapContextProps {\r\n readonly sources: MapLayerSource[];\r\n readonly loadingSources: boolean;\r\n readonly bases: MapLayerSource[];\r\n readonly refreshFromStyle: () => void;\r\n readonly activeViewport?: ScreenViewport;\r\n readonly backgroundLayers?: StyleMapLayerSettings[];\r\n readonly overlayLayers?: StyleMapLayerSettings[];\r\n readonly mapLayerOptions?: MapLayerOptions;\r\n}\r\n\r\n/** @internal */\r\nexport const SourceMapContext = React.createContext<SourceMapContextProps>({ // eslint-disable-line @typescript-eslint/naming-convention\r\n sources: [],\r\n loadingSources: false,\r\n bases: [],\r\n refreshFromStyle: () => { },\r\n});\r\n\r\n/** @internal */\r\nexport function useSourceMapContext(): SourceMapContextProps {\r\n return React.useContext(SourceMapContext);\r\n}\r\n\r\nfunction getSubLayerProps(subLayerSettings: MapSubLayerSettings[]): MapSubLayerProps[] {\r\n return subLayerSettings.map((subLayer) => subLayer.toJSON());\r\n}\r\n\r\nfunction getMapLayerSettingsFromViewport(viewport: Viewport, getBackgroundMap: boolean, populateSubLayers = true): StyleMapLayerSettings[] | undefined {\r\n const displayStyle = viewport.displayStyle;\r\n if (!displayStyle)\r\n return undefined;\r\n\r\n const layers = new Array<StyleMapLayerSettings>();\r\n\r\n const displayStyleLayers = (getBackgroundMap ? displayStyle.backgroundMapLayers : displayStyle.overlayMapLayers);\r\n for (let layerIdx = 0; layerIdx < displayStyleLayers.length; layerIdx++) {\r\n const layerSettings = displayStyleLayers[layerIdx];\r\n const isOverlay = !getBackgroundMap;\r\n const layerProvider = viewport.getMapLayerImageryProvider(layerIdx, isOverlay);\r\n const popSubLayers = populateSubLayers && (layerSettings instanceof ImageMapLayerSettings);\r\n layers.push({\r\n visible: layerSettings.visible,\r\n name: layerSettings.name,\r\n source: layerSettings.source,\r\n transparency: layerSettings.transparency,\r\n transparentBackground: layerSettings.transparentBackground,\r\n subLayers: popSubLayers ? getSubLayerProps(layerSettings.subLayers) : undefined,\r\n showSubLayers: false,\r\n isOverlay,\r\n provider: layerProvider,\r\n });\r\n }\r\n\r\n // since we want to display higher level maps above lower maps in UI reverse their order here.\r\n return layers.reverse();\r\n}\r\n\r\ninterface MapLayerManagerProps {\r\n getContainerForClone: () => HTMLElement;\r\n activeViewport: ScreenViewport;\r\n mapLayerOptions?: MapLayerOptions;\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function MapLayerManager(props: MapLayerManagerProps) {\r\n const [mapSources, setMapSources] = React.useState<MapLayerSource[] | undefined>();\r\n const [loadingSources, setLoadingSources] = React.useState(false);\r\n const [baseSources, setBaseSources] = React.useState<MapLayerSource[] | undefined>();\r\n const [overlaysLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.OverlayLayers\"));\r\n const [underlaysLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.BackgroundLayers\"));\r\n const { activeViewport, mapLayerOptions } = props;\r\n const hideExternalMapLayersSection = mapLayerOptions?.hideExternalMapLayers ? mapLayerOptions.hideExternalMapLayers : false;\r\n const fetchPublicMapLayerSources = mapLayerOptions?.fetchPublicMapLayerSources ? mapLayerOptions.fetchPublicMapLayerSources : false;\r\n\r\n // map layer settings from display style\r\n const [backgroundMapLayers, setBackgroundMapLayers] = React.useState<StyleMapLayerSettings[] | undefined>(getMapLayerSettingsFromViewport(activeViewport, true));\r\n const [overlayMapLayers, setOverlayMapLayers] = React.useState<StyleMapLayerSettings[] | undefined>(getMapLayerSettingsFromViewport(activeViewport, false));\r\n\r\n const loadMapLayerSettingsFromViewport = React.useCallback((viewport: Viewport) => {\r\n setBackgroundMapLayers(getMapLayerSettingsFromViewport(viewport, true));\r\n setOverlayMapLayers(getMapLayerSettingsFromViewport(viewport, false));\r\n }, [setBackgroundMapLayers, setOverlayMapLayers]);\r\n\r\n const [backgroundMapVisible, setBackgroundMapVisible] = React.useState(() => {\r\n if (activeViewport) {\r\n return activeViewport.viewFlags.backgroundMap;\r\n }\r\n return false;\r\n });\r\n\r\n // 'isMounted' is used to prevent any async operation once the hook has been\r\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\r\n const isMounted = React.useRef(false);\r\n React.useEffect(() => {\r\n isMounted.current = true;\r\n return () => {\r\n isMounted.current = false;\r\n };\r\n });\r\n\r\n // Setup onTileTreeLoad events listening.\r\n // This is needed because we need to know when the imagery provider\r\n // is created, and be able to monitor to status change.\r\n React.useEffect(() => {\r\n const handleTileTreeLoad = (args: TileTreeOwner) => {\r\n\r\n // Ignore non-map tile trees\r\n if (args.tileTree instanceof ImageryMapTileTree) {\r\n loadMapLayerSettingsFromViewport(activeViewport);\r\n }\r\n };\r\n\r\n IModelApp.tileAdmin.onTileTreeLoad.addListener(handleTileTreeLoad);\r\n\r\n return () => {\r\n IModelApp.tileAdmin.onTileTreeLoad.removeListener(handleTileTreeLoad);\r\n };\r\n\r\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\r\n\r\n // Setup onMapImageryChanged events listening.\r\n\r\n React.useEffect(() => {\r\n const handleMapImageryChanged = (args: Readonly<MapImagerySettings>) => {\r\n\r\n if (args.backgroundLayers.length !== (backgroundMapLayers ? backgroundMapLayers.length : 0)\r\n || args.overlayLayers.length !== (overlayMapLayers ? overlayMapLayers.length : 0)) {\r\n loadMapLayerSettingsFromViewport(activeViewport);\r\n }\r\n };\r\n activeViewport?.displayStyle.settings.onMapImageryChanged.addListener(handleMapImageryChanged);\r\n\r\n return () => {\r\n activeViewport?.displayStyle.settings.onMapImageryChanged.removeListener(handleMapImageryChanged);\r\n };\r\n }, [activeViewport, backgroundMapLayers, loadMapLayerSettingsFromViewport, overlayMapLayers]);\r\n\r\n const handleProviderStatusChanged = React.useCallback((_args: MapLayerImageryProvider) => {\r\n loadMapLayerSettingsFromViewport(activeViewport);\r\n }, [loadMapLayerSettingsFromViewport, activeViewport]);\r\n\r\n // Triggered whenever a provider status change\r\n React.useEffect(() => {\r\n backgroundMapLayers?.forEach((layer) => { layer.provider?.onStatusChanged.addListener(handleProviderStatusChanged); });\r\n overlayMapLayers?.forEach((layer) => { layer.provider?.onStatusChanged.addListener(handleProviderStatusChanged); });\r\n\r\n return () => {\r\n backgroundMapLayers?.forEach((layer) => { layer.provider?.onStatusChanged.removeListener(handleProviderStatusChanged); });\r\n overlayMapLayers?.forEach((layer) => { layer.provider?.onStatusChanged.removeListener(handleProviderStatusChanged); });\r\n };\r\n\r\n }, [backgroundMapLayers, overlayMapLayers, activeViewport, loadMapLayerSettingsFromViewport, handleProviderStatusChanged]);\r\n\r\n // Monitor viewport updates, and refresh the widget accordingly.\r\n // Note: This is needed for multiple viewport applications.\r\n React.useEffect(() => {\r\n // Update background map status\r\n setBackgroundMapVisible(activeViewport.viewFlags.backgroundMap);\r\n\r\n // Refresh list of layers\r\n loadMapLayerSettingsFromViewport(activeViewport);\r\n\r\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\r\n\r\n React.useEffect(() => {\r\n async function fetchWmsMapData() {\r\n const sources: MapLayerSource[] = [];\r\n const bases: MapLayerSource[] = [];\r\n const sourceLayers = await MapLayerSources.create(undefined, (fetchPublicMapLayerSources && !hideExternalMapLayersSection));\r\n\r\n const iModel = IModelApp.viewManager.selectedView ? IModelApp.viewManager.selectedView.iModel : undefined;\r\n try {\r\n const preferenceSources = ( iModel?.iTwinId === undefined\r\n ? []\r\n : await MapLayerPreferences.getSources(iModel?.iTwinId, iModel?.iModelId)\r\n );\r\n for (const source of preferenceSources)\r\n await MapLayerSources.addSourceToMapLayerSources(source);\r\n } catch (err) {\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.ErrorLoadingLayers\"), BentleyError.getErrorMessage(err)));\r\n }\r\n\r\n if (!isMounted.current) {\r\n return;\r\n }\r\n\r\n // This is where the list of layers first gets populated... I need to update it\r\n // MapUrlDialog gets around knowing MapLayerManager exists and vice versa by affecting the viewports displayStyle which MapLayerManager is listening for\r\n // We know when displayStyle changes we've added a layer, this layer may not be a custom layer\r\n sourceLayers?.layers.forEach((source: MapLayerSource) => { sources.push(source); });\r\n setMapSources(sources);\r\n sourceLayers?.bases.forEach((source: MapLayerSource) => { bases.push(source); });\r\n setBaseSources(bases);\r\n }\r\n\r\n setLoadingSources(true);\r\n fetchWmsMapData().then(() => {\r\n if (isMounted.current) {\r\n setLoadingSources(false);\r\n }\r\n\r\n }).catch(() => {\r\n if (isMounted.current) {\r\n setLoadingSources(false);\r\n }\r\n });\r\n }, [setMapSources, fetchPublicMapLayerSources, hideExternalMapLayersSection]);\r\n\r\n const updateMapSources = React.useCallback(() => {\r\n const newSources: MapLayerSource[] = [];\r\n MapLayerSources.getInstance()?.layers?.forEach((sourceLayer: MapLayerSource) => { newSources.push(sourceLayer); });\r\n setMapSources(newSources);\r\n }, [setMapSources]);\r\n\r\n /**\r\n * Handle change events in the MapLayerPreferences\r\n */\r\n React.useEffect(() => {\r\n const handleLayerSourceChange = async (changeType: MapLayerSourceChangeType, oldSource?: MapLayerSource, newSource?: MapLayerSource) => {\r\n const removeSourceOnly = (changeType === MapLayerSourceChangeType.Removed);\r\n const removeSource = (changeType === MapLayerSourceChangeType.Replaced || changeType === MapLayerSourceChangeType.Removed);\r\n const addSource = (changeType === MapLayerSourceChangeType.Replaced || changeType === MapLayerSourceChangeType.Added);\r\n\r\n if (removeSource) {\r\n if (oldSource) {\r\n const succeeded = MapLayerSources.removeLayerByName(oldSource.name);\r\n assert(succeeded);\r\n if (!succeeded) {\r\n return;\r\n }\r\n\r\n if (removeSourceOnly) {\r\n updateMapSources();\r\n return;\r\n }\r\n }\r\n }\r\n\r\n if (addSource) {\r\n const sources = await MapLayerSources.addSourceToMapLayerSources(newSource);\r\n assert(sources !== undefined);\r\n if (sources) {\r\n updateMapSources();\r\n }\r\n }\r\n };\r\n MapLayerPreferences.onLayerSourceChanged.addListener(handleLayerSourceChange);\r\n return (() => {\r\n MapLayerPreferences.onLayerSourceChanged.removeListener(handleLayerSourceChange);\r\n });\r\n }, [updateMapSources]);\r\n\r\n // update when a different display style is loaded.\r\n React.useEffect(() => {\r\n const handleDisplayStyleChange = (vp: Viewport) => {\r\n loadMapLayerSettingsFromViewport(vp);\r\n };\r\n activeViewport?.onDisplayStyleChanged.addListener(handleDisplayStyleChange);\r\n return () => {\r\n activeViewport?.onDisplayStyleChanged.removeListener(handleDisplayStyleChange);\r\n };\r\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\r\n\r\n const handleOnMenuItemSelection = React.useCallback((action: string, mapLayerSettings: StyleMapLayerSettings) => {\r\n if (!activeViewport || !activeViewport.displayStyle)\r\n return;\r\n\r\n const indexInDisplayStyle = activeViewport.displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);\r\n if (indexInDisplayStyle < 0)\r\n return;\r\n\r\n switch (action) {\r\n case \"delete\":\r\n activeViewport.displayStyle.detachMapLayerByIndex(indexInDisplayStyle, mapLayerSettings.isOverlay);\r\n break;\r\n case \"zoom-to-layer\":\r\n activeViewport.displayStyle.viewMapLayerRange(indexInDisplayStyle, mapLayerSettings.isOverlay, activeViewport).then((status) => {\r\n if (!status) {\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.NoRangeDefined\");\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, `${msg} [${mapLayerSettings.name}]`));\r\n }\r\n }).catch((_error) => { });\r\n break;\r\n }\r\n activeViewport.invalidateRenderPlan();\r\n\r\n // force UI to update\r\n loadMapLayerSettingsFromViewport(activeViewport);\r\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\r\n\r\n const handleLayerVisibilityChange = React.useCallback((mapLayerSettings: StyleMapLayerSettings) => {\r\n if (activeViewport) {\r\n const isVisible = !mapLayerSettings.visible;\r\n\r\n const displayStyle = activeViewport.displayStyle;\r\n const indexInDisplayStyle = displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);\r\n if (-1 !== indexInDisplayStyle) {\r\n // update the display style\r\n displayStyle.changeMapLayerProps({ visible: isVisible }, indexInDisplayStyle, mapLayerSettings.isOverlay);\r\n activeViewport.invalidateRenderPlan();\r\n\r\n // force UI to update\r\n loadMapLayerSettingsFromViewport(activeViewport);\r\n }\r\n }\r\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\r\n\r\n const handleMapLayersToggle = React.useCallback(() => {\r\n if (activeViewport) {\r\n const newState = !backgroundMapVisible;\r\n activeViewport.viewFlags = activeViewport.viewFlags.with(\"backgroundMap\", newState);\r\n setBackgroundMapVisible(newState);\r\n }\r\n }, [backgroundMapVisible, setBackgroundMapVisible, activeViewport]);\r\n\r\n const handleOnMapLayerDragEnd = React.useCallback((result: DropResult /* , _provided: ResponderProvided*/) => {\r\n const { destination, source } = result;\r\n\r\n if (!destination) // dropped outside of list\r\n return;\r\n\r\n // item was not moved\r\n if (destination.droppableId === source.droppableId && destination.index === source.index)\r\n return;\r\n\r\n let fromMapLayer: StyleMapLayerSettings | undefined;\r\n if (source.droppableId === \"overlayMapLayers\" && overlayMapLayers)\r\n fromMapLayer = overlayMapLayers[source.index];\r\n else if (source.droppableId === \"backgroundMapLayers\" && backgroundMapLayers)\r\n fromMapLayer = backgroundMapLayers[source.index];\r\n\r\n if (!fromMapLayer || !activeViewport)\r\n return;\r\n\r\n const displayStyle = activeViewport.displayStyle;\r\n let toMapLayer: StyleMapLayerSettings | undefined;\r\n let toIndexInDisplayStyle = -1;\r\n\r\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.\r\n // We need to do this because the order of layers in UI are reversed so higher layers appear above lower layers.\r\n if (undefined !== destination.index) {\r\n if (destination.droppableId === \"overlayMapLayers\" && overlayMapLayers)\r\n toMapLayer = overlayMapLayers[destination.index];\r\n else if (destination.droppableId === \"backgroundMapLayers\" && backgroundMapLayers)\r\n toMapLayer = backgroundMapLayers[destination.index];\r\n if (toMapLayer)\r\n toIndexInDisplayStyle = displayStyle.findMapLayerIndexByNameAndSource(toMapLayer.name, toMapLayer.source, toMapLayer.isOverlay);\r\n }\r\n\r\n const fromIndexInDisplayStyle = displayStyle.findMapLayerIndexByNameAndSource(fromMapLayer.name, fromMapLayer.source, fromMapLayer.isOverlay);\r\n if (fromIndexInDisplayStyle < 0)\r\n return;\r\n\r\n if (destination.droppableId !== source.droppableId) {\r\n // see if we moved from \"overlayMapLayers\" to \"backgroundMapLayers\" or vice-versa\r\n const settings = activeViewport.displayStyle.mapLayerAtIndex(fromIndexInDisplayStyle, fromMapLayer.isOverlay);\r\n if (settings) {\r\n activeViewport.displayStyle.detachMapLayerByIndex(fromIndexInDisplayStyle, fromMapLayer.isOverlay);\r\n\r\n // Manually reverse index when moved from one section to the other\r\n if (fromMapLayer.isOverlay && backgroundMapLayers) {\r\n toIndexInDisplayStyle = displayStyle.backgroundMapLayers.length - destination.index;\r\n } else if (!fromMapLayer.isOverlay && overlayMapLayers) {\r\n toIndexInDisplayStyle = overlayMapLayers.length - destination.index;\r\n }\r\n\r\n activeViewport.displayStyle.attachMapLayer({settings, isOverlay:!fromMapLayer.isOverlay, insertIndex:toIndexInDisplayStyle});\r\n }\r\n } else {\r\n if (undefined === destination.index) {\r\n displayStyle.moveMapLayerToBottom(fromIndexInDisplayStyle, destination.droppableId === \"overlayMapLayers\");\r\n } else {\r\n if (toMapLayer) {\r\n if (toIndexInDisplayStyle !== -1)\r\n displayStyle.moveMapLayerToIndex(fromIndexInDisplayStyle, toIndexInDisplayStyle, toMapLayer.isOverlay);\r\n }\r\n }\r\n }\r\n\r\n // apply display style change to view\r\n activeViewport.invalidateRenderPlan();\r\n\r\n // force UI to update\r\n loadMapLayerSettingsFromViewport(activeViewport);\r\n }, [loadMapLayerSettingsFromViewport, activeViewport, overlayMapLayers, backgroundMapLayers]);\r\n\r\n const handleRefreshFromStyle = React.useCallback(() => {\r\n if (activeViewport)\r\n loadMapLayerSettingsFromViewport(activeViewport);\r\n }, [activeViewport, loadMapLayerSettingsFromViewport]);\r\n\r\n const [baseMapPanelLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.BaseMapPanelTitle\"));\r\n\r\n return (\r\n <SourceMapContext.Provider value={{\r\n activeViewport,\r\n loadingSources,\r\n sources: mapSources ? mapSources : [],\r\n bases: baseSources ? baseSources : [],\r\n refreshFromStyle: handleRefreshFromStyle,\r\n backgroundLayers: backgroundMapLayers,\r\n overlayLayers: overlayMapLayers,\r\n mapLayerOptions,\r\n }}>\r\n <div className=\"map-manager-top-header\">\r\n <span className=\"map-manager-header-label\">{baseMapPanelLabel}</span>\r\n <div className=\"map-manager-header-buttons-group\">\r\n <ToggleSwitch className=\"map-manager-toggle\" checked={backgroundMapVisible} onChange={handleMapLayersToggle} />\r\n <MapLayerSettingsPopupButton disabled={!backgroundMapVisible}/>\r\n </div>\r\n </div>\r\n\r\n <div className=\"map-manager-container\">\r\n\r\n <div className=\"map-manager-basemap\">\r\n <BasemapPanel disabled={!backgroundMapVisible} />\r\n </div>\r\n {!hideExternalMapLayersSection &&\r\n <DragDropContext onDragEnd={handleOnMapLayerDragEnd}>\r\n <div className=\"map-manager-layer-wrapper\">\r\n <div className=\"map-manager-underlays\" >\r\n <span className=\"map-manager-underlays-label\">{underlaysLabel}</span><AttachLayerPopupButton disabled={!backgroundMapVisible} isOverlay={false} />\r\n </div>\r\n <MapLayerDroppable\r\n disabled={!backgroundMapVisible}\r\n isOverlay={false}\r\n layersList={backgroundMapLayers}\r\n mapTypesOptions={props.mapLayerOptions?.mapTypeOptions}\r\n getContainerForClone={props.getContainerForClone as any}\r\n activeViewport={props.activeViewport}\r\n onMenuItemSelected={handleOnMenuItemSelection}\r\n onItemVisibilityToggleClicked={handleLayerVisibilityChange}\r\n onItemEdited={handleRefreshFromStyle} />\r\n </div>\r\n\r\n <div className=\"map-manager-layer-wrapper\">\r\n <div className=\"map-manager-overlays\" >\r\n <span className=\"map-manager-overlays-label\">{overlaysLabel}</span><AttachLayerPopupButton disabled={!backgroundMapVisible} isOverlay={true} />\r\n </div>\r\n <MapLayerDroppable\r\n disabled={!backgroundMapVisible}\r\n isOverlay={true}\r\n layersList={overlayMapLayers}\r\n mapTypesOptions={props.mapLayerOptions?.mapTypeOptions}\r\n getContainerForClone={props.getContainerForClone as any}\r\n activeViewport={props.activeViewport}\r\n onMenuItemSelected={handleOnMenuItemSelection}\r\n onItemVisibilityToggleClicked={handleLayerVisibilityChange}\r\n onItemEdited={handleRefreshFromStyle} />\r\n </div>\r\n </DragDropContext>\r\n }\r\n </div >\r\n </SourceMapContext.Provider >\r\n );\r\n}\r\n\r\n"]}
@@ -233,6 +233,12 @@ $default-icon-height: 20px;
233
233
  overflow: hidden;
234
234
  margin-left: 2px;
235
235
  }
236
+
237
+ .map-manager-item-label-disabled {
238
+ @extend .map-manager-item-label;
239
+ color: $buic-foreground-muted;
240
+ }
241
+
236
242
  .map-manager-item-transparency {
237
243
  margin-right: 6px;
238
244
  }
@@ -2,9 +2,12 @@
2
2
  import { ScreenViewport } from "@itwin/core-frontend";
3
3
  import "./MapLayerManager.scss";
4
4
  import { StyleMapLayerSettings } from "../Interfaces";
5
- export declare function MapLayerSettingsMenu({ mapLayerSettings, onMenuItemSelection, activeViewport }: {
5
+ interface MapLayerSettingsMenuProps {
6
6
  mapLayerSettings: StyleMapLayerSettings;
7
7
  onMenuItemSelection: (action: string, mapLayerSettings: StyleMapLayerSettings) => void;
8
8
  activeViewport: ScreenViewport;
9
- }): JSX.Element;
9
+ disabled?: boolean;
10
+ }
11
+ export declare function MapLayerSettingsMenu({ mapLayerSettings, onMenuItemSelection, activeViewport, disabled }: MapLayerSettingsMenuProps): JSX.Element;
12
+ export {};
10
13
  //# sourceMappingURL=MapLayerSettingsMenu.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MapLayerSettingsMenu.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerSettingsMenu.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD,OAAO,wBAAwB,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAItD,wBAAgB,oBAAoB,CAAC,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,cAAc,EAAE,EAAE;IAAE,gBAAgB,EAAE,qBAAqB,CAAC;IAAC,mBAAmB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAAC,cAAc,EAAE,cAAc,CAAA;CAAE,eAkFlQ"}
1
+ {"version":3,"file":"MapLayerSettingsMenu.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerSettingsMenu.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD,OAAO,wBAAwB,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAGtD,UAAU,yBAAyB;IACjC,gBAAgB,EAAE,qBAAqB,CAAC;IACxC,mBAAmB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACvF,cAAc,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAGD,wBAAgB,oBAAoB,CAAC,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,yBAAyB,eAkFlI"}
@@ -8,7 +8,7 @@ import { Button, Slider } from "@itwin/itwinui-react";
8
8
  import "./MapLayerManager.scss";
9
9
  import { MapLayersUI } from "../../mapLayers";
10
10
  // eslint-disable-next-line @typescript-eslint/naming-convention
11
- export function MapLayerSettingsMenu({ mapLayerSettings, onMenuItemSelection, activeViewport }) {
11
+ export function MapLayerSettingsMenu({ mapLayerSettings, onMenuItemSelection, activeViewport, disabled }) {
12
12
  const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);
13
13
  const settingsRef = React.useRef(null);
14
14
  const [labelDetach] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:LayerMenu.Detach"));
@@ -69,7 +69,7 @@ export function MapLayerSettingsMenu({ mapLayerSettings, onMenuItemSelection, ac
69
69
  }
70
70
  }, [transparency, applyTransparencyChange]);
71
71
  return (React.createElement(React.Fragment, null,
72
- React.createElement(Button, { size: "small", styleType: "borderless", "data-testid": "map-layer-settings", className: "map-layer-settings icon icon-more-vertical-2", ref: settingsRef, onClick: onSettingsClick }),
72
+ React.createElement(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 }),
73
73
  React.createElement(ContextMenu, { opened: isSettingsOpen && (undefined !== hasRangeData), onOutsideClick: handleCloseSetting },
74
74
  React.createElement("div", { className: "map-manager-item-menu" },
75
75
  React.createElement(ContextMenuItem, { hideIconContainer: true, key: 0, className: hasRangeData ? "" : "core-context-menu-disabled", onSelect: handleZoomToLayer }, labelZoomToLayer),
@@ -1 +1 @@
1
- {"version":3,"file":"MapLayerSettingsMenu.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerSettingsMenu.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,wBAAwB,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,gEAAgE;AAChE,MAAM,UAAU,oBAAoB,CAAC,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,cAAc,EAAuK;IACjQ,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClE,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAoB,IAAI,CAAC,CAAC;IAC1D,MAAM,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,4BAA4B,CAAC,CAAC,CAAC;IAChH,MAAM,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ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,EAAE,CAAC;oBAC9C,oBAAC,MAAM,IAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,YAAY,GAAG,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,wBAAwB,GAAI,CACvF,CACd,CACM,CACb,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport * as React from \"react\";\r\nimport { ScreenViewport } from \"@itwin/core-frontend\";\r\nimport { ContextMenu, ContextMenuItem } from \"@itwin/core-react\";\r\nimport { Button, Slider } from \"@itwin/itwinui-react\";\r\nimport \"./MapLayerManager.scss\";\r\nimport { StyleMapLayerSettings } from \"../Interfaces\";\r\nimport { MapLayersUI } from \"../../mapLayers\";\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function MapLayerSettingsMenu({ mapLayerSettings, onMenuItemSelection, activeViewport }: { mapLayerSettings: StyleMapLayerSettings, onMenuItemSelection: (action: string, mapLayerSettings: StyleMapLayerSettings) => void, activeViewport: ScreenViewport }) {\r\n const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);\r\n const settingsRef = React.useRef<HTMLButtonElement>(null);\r\n const [labelDetach] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:LayerMenu.Detach\"));\r\n const [labelZoomToLayer] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:LayerMenu.ZoomToLayer\"));\r\n const [hasRangeData, setHasRangeData] = React.useState<boolean | undefined>();\r\n const [transparency, setTransparency] = React.useState(mapLayerSettings.transparency);\r\n\r\n React.useEffect(() => {\r\n async function fetchRangeData() {\r\n let hasRange = false;\r\n const indexInDisplayStyle = activeViewport?.displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);\r\n if (undefined !== indexInDisplayStyle) {\r\n hasRange = (undefined !== await activeViewport.displayStyle.getMapLayerRange(indexInDisplayStyle, mapLayerSettings.isOverlay));\r\n }\r\n setHasRangeData(hasRange);\r\n }\r\n fetchRangeData(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n }, [activeViewport, mapLayerSettings]);\r\n\r\n const onSettingsClick = React.useCallback(() => {\r\n setIsSettingsOpen((prev) => !prev);\r\n }, [setIsSettingsOpen]);\r\n\r\n const handleCloseSetting = React.useCallback(() => {\r\n setIsSettingsOpen(false);\r\n }, [setIsSettingsOpen]);\r\n\r\n const handleRemoveLayer = React.useCallback(() => {\r\n setIsSettingsOpen(false);\r\n onMenuItemSelection(\"delete\", mapLayerSettings);\r\n }, [setIsSettingsOpen, onMenuItemSelection, mapLayerSettings]);\r\n\r\n const handleZoomToLayer = React.useCallback(() => {\r\n setIsSettingsOpen(false);\r\n onMenuItemSelection(\"zoom-to-layer\", mapLayerSettings);\r\n }, [setIsSettingsOpen, onMenuItemSelection, mapLayerSettings]);\r\n\r\n const applyTransparencyChange = React.useCallback((value: number) => {\r\n if (activeViewport) {\r\n const newTransparency = value;\r\n const displayStyle = activeViewport.displayStyle;\r\n const indexInDisplayStyle = displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);\r\n if (-1 !== indexInDisplayStyle) {\r\n const styleTransparency = displayStyle.mapLayerAtIndex(indexInDisplayStyle, mapLayerSettings.isOverlay)?.transparency;\r\n const styleTransparencyValue = styleTransparency ? styleTransparency : 0;\r\n if (Math.abs(styleTransparencyValue - newTransparency) > 0.01) {\r\n // update the display style\r\n displayStyle.changeMapLayerProps({ transparency: newTransparency }, indexInDisplayStyle, mapLayerSettings.isOverlay);\r\n activeViewport.invalidateRenderPlan();\r\n\r\n // force UI to update\r\n // loadMapLayerSettingsFromStyle(activeViewport.displayStyle);\r\n }\r\n }\r\n }\r\n }, [activeViewport, mapLayerSettings]);\r\n\r\n const handleTransparencyChange = React.useCallback((values: readonly number[]) => {\r\n if (values.length) {\r\n const newTransparency = values[0] / 100.0;\r\n if (newTransparency !== transparency) {\r\n setTransparency(newTransparency);\r\n applyTransparencyChange(newTransparency);\r\n }\r\n }\r\n }, [transparency, applyTransparencyChange]);\r\n\r\n return (\r\n <>\r\n <Button size=\"small\" styleType=\"borderless\" data-testid=\"map-layer-settings\" className=\"map-layer-settings icon icon-more-vertical-2\" ref={settingsRef} onClick={onSettingsClick} ></Button>\r\n <ContextMenu opened={isSettingsOpen && (undefined !== hasRangeData)} onOutsideClick={handleCloseSetting} >\r\n <div className=\"map-manager-item-menu\" >\r\n <ContextMenuItem hideIconContainer={true} key={0} className={hasRangeData ? \"\" : \"core-context-menu-disabled\"} onSelect={handleZoomToLayer}>{labelZoomToLayer}</ContextMenuItem>\r\n <ContextMenuItem hideIconContainer={true} key={1} onSelect={handleRemoveLayer}>{labelDetach}</ContextMenuItem>\r\n <ContextMenuItem hideIconContainer={true} key={2} >\r\n <Slider min={0} max={100} values={[transparency * 100]} step={1} onChange={handleTransparencyChange} />\r\n </ContextMenuItem>\r\n </div>\r\n </ContextMenu>\r\n </>\r\n );\r\n}\r\n"]}
1
+ {"version":3,"file":"MapLayerSettingsMenu.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerSettingsMenu.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,wBAAwB,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAS9C,gEAAgE;AAChE,MAAM,UAAU,oBAAoB,CAAC,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,cAAc,EAAE,QAAQ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uBAAuB;gBACpC,oBAAC,eAAe,IAAC,iBAAiB,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,4BAA4B,EAAE,QAAQ,EAAE,iBAAiB,IAAG,gBAAgB,CAAmB;gBAChL,oBAAC,eAAe,IAAC,iBAAiB,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,QAAQ,EAAE,iBAAiB,IAAG,WAAW,CAAmB;gBAC9G,oBAAC,eAAe,IAAC,iBAAiB,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;oBAC9C,oBAAC,MAAM,IAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,YAAY,GAAG,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,wBAAwB,GAAI,CACvF,CACd,CACM,CACb,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport * as React from \"react\";\r\nimport { ScreenViewport } from \"@itwin/core-frontend\";\r\nimport { ContextMenu, ContextMenuItem } from \"@itwin/core-react\";\r\nimport { Button, Slider } from \"@itwin/itwinui-react\";\r\nimport \"./MapLayerManager.scss\";\r\nimport { StyleMapLayerSettings } from \"../Interfaces\";\r\nimport { MapLayersUI } from \"../../mapLayers\";\r\n\r\ninterface MapLayerSettingsMenuProps {\r\n mapLayerSettings: StyleMapLayerSettings;\r\n onMenuItemSelection: (action: string, mapLayerSettings: StyleMapLayerSettings) => void;\r\n activeViewport: ScreenViewport;\r\n disabled?: boolean;\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function MapLayerSettingsMenu({ mapLayerSettings, onMenuItemSelection, activeViewport, disabled }: MapLayerSettingsMenuProps) {\r\n const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);\r\n const settingsRef = React.useRef<HTMLButtonElement>(null);\r\n const [labelDetach] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:LayerMenu.Detach\"));\r\n const [labelZoomToLayer] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:LayerMenu.ZoomToLayer\"));\r\n const [hasRangeData, setHasRangeData] = React.useState<boolean | undefined>();\r\n const [transparency, setTransparency] = React.useState(mapLayerSettings.transparency);\r\n\r\n React.useEffect(() => {\r\n async function fetchRangeData() {\r\n let hasRange = false;\r\n const indexInDisplayStyle = activeViewport?.displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);\r\n if (undefined !== indexInDisplayStyle) {\r\n hasRange = (undefined !== await activeViewport.displayStyle.getMapLayerRange(indexInDisplayStyle, mapLayerSettings.isOverlay));\r\n }\r\n setHasRangeData(hasRange);\r\n }\r\n fetchRangeData(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n }, [activeViewport, mapLayerSettings]);\r\n\r\n const onSettingsClick = React.useCallback(() => {\r\n setIsSettingsOpen((prev) => !prev);\r\n }, [setIsSettingsOpen]);\r\n\r\n const handleCloseSetting = React.useCallback(() => {\r\n setIsSettingsOpen(false);\r\n }, [setIsSettingsOpen]);\r\n\r\n const handleRemoveLayer = React.useCallback(() => {\r\n setIsSettingsOpen(false);\r\n onMenuItemSelection(\"delete\", mapLayerSettings);\r\n }, [setIsSettingsOpen, onMenuItemSelection, mapLayerSettings]);\r\n\r\n const handleZoomToLayer = React.useCallback(() => {\r\n setIsSettingsOpen(false);\r\n onMenuItemSelection(\"zoom-to-layer\", mapLayerSettings);\r\n }, [setIsSettingsOpen, onMenuItemSelection, mapLayerSettings]);\r\n\r\n const applyTransparencyChange = React.useCallback((value: number) => {\r\n if (activeViewport) {\r\n const newTransparency = value;\r\n const displayStyle = activeViewport.displayStyle;\r\n const indexInDisplayStyle = displayStyle.findMapLayerIndexByNameAndSource(mapLayerSettings.name, mapLayerSettings.source, mapLayerSettings.isOverlay);\r\n if (-1 !== indexInDisplayStyle) {\r\n const styleTransparency = displayStyle.mapLayerAtIndex(indexInDisplayStyle, mapLayerSettings.isOverlay)?.transparency;\r\n const styleTransparencyValue = styleTransparency ? styleTransparency : 0;\r\n if (Math.abs(styleTransparencyValue - newTransparency) > 0.01) {\r\n // update the display style\r\n displayStyle.changeMapLayerProps({ transparency: newTransparency }, indexInDisplayStyle, mapLayerSettings.isOverlay);\r\n activeViewport.invalidateRenderPlan();\r\n\r\n // force UI to update\r\n // loadMapLayerSettingsFromStyle(activeViewport.displayStyle);\r\n }\r\n }\r\n }\r\n }, [activeViewport, mapLayerSettings]);\r\n\r\n const handleTransparencyChange = React.useCallback((values: readonly number[]) => {\r\n if (values.length) {\r\n const newTransparency = values[0] / 100.0;\r\n if (newTransparency !== transparency) {\r\n setTransparency(newTransparency);\r\n applyTransparencyChange(newTransparency);\r\n }\r\n }\r\n }, [transparency, applyTransparencyChange]);\r\n\r\n return (\r\n <>\r\n <Button disabled={disabled} size=\"small\" styleType=\"borderless\" data-testid=\"map-layer-settings\" className=\"map-layer-settings icon icon-more-vertical-2\" ref={settingsRef} onClick={onSettingsClick} ></Button>\r\n <ContextMenu opened={isSettingsOpen && (undefined !== hasRangeData)} onOutsideClick={handleCloseSetting} >\r\n <div className=\"map-manager-item-menu\" >\r\n <ContextMenuItem hideIconContainer={true} key={0} className={hasRangeData ? \"\" : \"core-context-menu-disabled\"} onSelect={handleZoomToLayer}>{labelZoomToLayer}</ContextMenuItem>\r\n <ContextMenuItem hideIconContainer={true} key={1} onSelect={handleRemoveLayer}>{labelDetach}</ContextMenuItem>\r\n <ContextMenuItem hideIconContainer={true} key={2} >\r\n <Slider min={0} max={100} values={[transparency * 100]} step={1} onChange={handleTransparencyChange} />\r\n </ContextMenuItem>\r\n </div>\r\n </ContextMenu>\r\n </>\r\n );\r\n}\r\n"]}
@@ -1,5 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import "./MapLayerSettingsPopupButton.scss";
3
+ export interface MapLayerSettingsPopupButtonProps {
4
+ disabled?: boolean;
5
+ }
3
6
  /** @alpha */
4
- export declare function MapLayerSettingsPopupButton(): JSX.Element;
7
+ export declare function MapLayerSettingsPopupButton(props: MapLayerSettingsPopupButtonProps): JSX.Element;
5
8
  //# sourceMappingURL=MapLayerSettingsPopupButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MapLayerSettingsPopupButton.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerSettingsPopupButton.tsx"],"names":[],"mappings":";AAUA,OAAO,oCAAoC,CAAC;AAI5C,aAAa;AAEb,wBAAgB,2BAA2B,gBAoE1C"}
1
+ {"version":3,"file":"MapLayerSettingsPopupButton.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerSettingsPopupButton.tsx"],"names":[],"mappings":";AAUA,OAAO,oCAAoC,CAAC;AAG5C,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,aAAa;AAEb,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,gCAAgC,eAoElF"}
@@ -11,7 +11,7 @@ import { MapLayersUI } from "../../mapLayers";
11
11
  import { Button } from "@itwin/itwinui-react";
12
12
  /** @alpha */
13
13
  // eslint-disable-next-line @typescript-eslint/naming-convention
14
- export function MapLayerSettingsPopupButton() {
14
+ export function MapLayerSettingsPopupButton(props) {
15
15
  const panelRef = React.useRef(null);
16
16
  const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);
17
17
  const [buttonTooltip] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:Widget.SettingsButtonTooltip"));
@@ -53,7 +53,7 @@ export function MapLayerSettingsPopupButton() {
53
53
  setIsSettingsOpen(false);
54
54
  }, [isInsideCoreDialog]);
55
55
  return (React.createElement(React.Fragment, null,
56
- React.createElement(Button, { styleType: "borderless", title: buttonTooltip, className: "maplayers-settings-popup-button", onClick: togglePopupDisplay, ref: buttonRef },
56
+ React.createElement(Button, { disabled: props.disabled, styleType: "borderless", title: buttonTooltip, className: "maplayers-settings-popup-button", onClick: togglePopupDisplay, ref: buttonRef },
57
57
  React.createElement(WebFontIcon, { iconName: "icon-settings" })),
58
58
  React.createElement(Popup, { isOpen: isSettingsOpen, position: RelativePosition.BottomRight, onClose: handleCloseSetting, target: buttonRef.current, onOutsideClick: handleOutsideClick, repositionOnResize: true },
59
59
  React.createElement("div", { ref: panelRef, className: "maplayers-settings-popup-panel" },
@@ -1 +1 @@
1
- {"version":3,"file":"MapLayerSettingsPopupButton.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerSettingsPopupButton.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,oCAAoC,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,aAAa;AACb,gEAAgE;AAChE,MAAM,UAAU,2BAA2B;IACzC,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAiB,IAAI,CAAC,CAAC;IACpD,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClE,MAAM,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,wCAAwC,CAAC,CAAC,CAAC;IAE9H,MAAM,SAAS,GAAG,KAAK,C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Q,CAAC,KAAK,CAAC,MAAc,CAAC,CAAA,EAAE;YAC3E,OAAO;SACR;QAED,wDAAwD;QACxD,IAAI,QAAQ,CAAC,OAAO,KAAI,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAc,CAAC,CAAA,EAAE;YACxE,OAAO;SACR;QAED,wEAAwE;QACxE,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAE3B,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAEzB,OAAO,CACL;QACE,oBAAC,MAAM,IAAC,SAAS,EAAC,YAAY,EAAC,KAAK,EAAE,aAAa,EAAE,SAAS,EAAC,iCAAiC,EAAC,OAAO,EAAE,kBAAkB,EAAE,GAAG,EAAE,SAAS;YAC1I,oBAAC,WAAW,IAAC,QAAQ,EAAC,eAAe,GAAG,CACjC;QACT,oBAAC,KAAK,IACJ,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,gBAAgB,CAAC,WAAW,EACtC,OAAO,EAAE,kBAAkB,EAC3B,MAAM,EAAE,SAAS,CAAC,OAAO,EACzB,cAAc,EAAE,kBAAkB,EAClC,kBAAkB,EAAE,IAAI;YAExB,6BAAK,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,gCAAgC;gBAC5D,oBAAC,kBAAkB,OAAG,CAClB,CACC,CACP,CACL,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport * as React from \"react\";\r\nimport { RelativePosition } from \"@itwin/appui-abstract\";\r\nimport { Popup, WebFontIcon } from \"@itwin/core-react\";\r\nimport { MapManagerSettings } from \"./MapManagerSettings\";\r\n\r\nimport \"./MapLayerSettingsPopupButton.scss\";\r\nimport { MapLayersUI } from \"../../mapLayers\";\r\nimport { Button } from \"@itwin/itwinui-react\";\r\n\r\n/** @alpha */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function MapLayerSettingsPopupButton() {\r\n const panelRef = React.useRef<HTMLDivElement>(null);\r\n const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);\r\n const [buttonTooltip] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.SettingsButtonTooltip\"));\r\n\r\n const buttonRef = React.useRef<HTMLButtonElement>(null);\r\n const togglePopupDisplay = React.useCallback((event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\r\n event.preventDefault();\r\n setIsSettingsOpen((prev) => !prev);\r\n }, [setIsSettingsOpen]);\r\n\r\n const handleCloseSetting = React.useCallback(() => {\r\n setIsSettingsOpen(false);\r\n }, [setIsSettingsOpen]);\r\n\r\n const isInsideCoreDialog = React.useCallback((element: HTMLElement) => {\r\n if (element.nodeName === \"DIV\") {\r\n if (element.classList && element.classList.contains(\"core-dialog\"))\r\n return true;\r\n if (element.parentElement && isInsideCoreDialog(element.parentElement))\r\n return true;\r\n } else {\r\n // istanbul ignore else\r\n if (element.parentElement && isInsideCoreDialog(element.parentElement))\r\n return true;\r\n }\r\n return false;\r\n }, []);\r\n\r\n const handleOutsideClick = React.useCallback((event: MouseEvent) => {\r\n if (isInsideCoreDialog(event.target as HTMLElement)) {\r\n return;\r\n }\r\n\r\n // If clicking on button that open panel - don't trigger outside click processing\r\n if (buttonRef?.current && buttonRef?.current.contains(event.target as Node)) {\r\n return;\r\n }\r\n\r\n // If clicking the panel, this is not an outside clicked\r\n if (panelRef.current && panelRef?.current.contains(event.target as Node)) {\r\n return;\r\n }\r\n\r\n // If we reach this point, we got an outside clicked, no close the popup\r\n setIsSettingsOpen(false);\r\n\r\n }, [isInsideCoreDialog]);\r\n\r\n return (\r\n <>\r\n <Button styleType=\"borderless\" title={buttonTooltip} className=\"maplayers-settings-popup-button\" onClick={togglePopupDisplay} ref={buttonRef}>\r\n <WebFontIcon iconName=\"icon-settings\" />\r\n </Button>\r\n <Popup\r\n isOpen={isSettingsOpen}\r\n position={RelativePosition.BottomRight}\r\n onClose={handleCloseSetting}\r\n target={buttonRef.current}\r\n onOutsideClick={handleOutsideClick}\r\n repositionOnResize={true}\r\n >\r\n <div ref={panelRef} className=\"maplayers-settings-popup-panel\">\r\n <MapManagerSettings />\r\n </div>\r\n </Popup >\r\n </ >\r\n );\r\n}\r\n"]}
1
+ {"version":3,"file":"MapLayerSettingsPopupButton.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerSettingsPopupButton.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,oCAAoC,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAK9C,aAAa;AACb,gEAAgE;AAChE,MAAM,UAAU,2BAA2B,CAAC,KAAuC;IACjF,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAiB,IAAI,CAAC,CAAC;IACpD,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClE,MAAM,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,wCAAwC,CAAC,CAAC,CAAC;IAE9H,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAoB,IAAI,CAAC,CAAC;IACxD,MAAM,kBAAkB,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,KAAsD,EAAE,EAAE;QAC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QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAc,CAAC,CAAA,EAAE;YACxE,OAAO;SACR;QAED,wEAAwE;QACxE,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAE3B,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAEzB,OAAO,CACL;QACE,oBAAC,MAAM,IAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAC,YAAY,EAAC,KAAK,EAAE,aAAa,EAAE,SAAS,EAAC,iCAAiC,EAAC,OAAO,EAAE,kBAAkB,EAAE,GAAG,EAAE,SAAS;YACpK,oBAAC,WAAW,IAAC,QAAQ,EAAC,eAAe,GAAG,CACjC;QACT,oBAAC,KAAK,IACJ,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,gBAAgB,CAAC,WAAW,EACtC,OAAO,EAAE,kBAAkB,EAC3B,MAAM,EAAE,SAAS,CAAC,OAAO,EACzB,cAAc,EAAE,kBAAkB,EAClC,kBAAkB,EAAE,IAAI;YAExB,6BAAK,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,gCAAgC;gBAC5D,oBAAC,kBAAkB,OAAG,CAClB,CACC,CACP,CACL,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport * as React from \"react\";\r\nimport { RelativePosition } from \"@itwin/appui-abstract\";\r\nimport { Popup, WebFontIcon } from \"@itwin/core-react\";\r\nimport { MapManagerSettings } from \"./MapManagerSettings\";\r\n\r\nimport \"./MapLayerSettingsPopupButton.scss\";\r\nimport { MapLayersUI } from \"../../mapLayers\";\r\nimport { Button } from \"@itwin/itwinui-react\";\r\nexport interface MapLayerSettingsPopupButtonProps {\r\n disabled?: boolean;\r\n}\r\n\r\n/** @alpha */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function MapLayerSettingsPopupButton(props: MapLayerSettingsPopupButtonProps) {\r\n const panelRef = React.useRef<HTMLDivElement>(null);\r\n const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);\r\n const [buttonTooltip] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.SettingsButtonTooltip\"));\r\n\r\n const buttonRef = React.useRef<HTMLButtonElement>(null);\r\n const togglePopupDisplay = React.useCallback((event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\r\n event.preventDefault();\r\n setIsSettingsOpen((prev) => !prev);\r\n }, [setIsSettingsOpen]);\r\n\r\n const handleCloseSetting = React.useCallback(() => {\r\n setIsSettingsOpen(false);\r\n }, [setIsSettingsOpen]);\r\n\r\n const isInsideCoreDialog = React.useCallback((element: HTMLElement) => {\r\n if (element.nodeName === \"DIV\") {\r\n if (element.classList && element.classList.contains(\"core-dialog\"))\r\n return true;\r\n if (element.parentElement && isInsideCoreDialog(element.parentElement))\r\n return true;\r\n } else {\r\n // istanbul ignore else\r\n if (element.parentElement && isInsideCoreDialog(element.parentElement))\r\n return true;\r\n }\r\n return false;\r\n }, []);\r\n\r\n const handleOutsideClick = React.useCallback((event: MouseEvent) => {\r\n if (isInsideCoreDialog(event.target as HTMLElement)) {\r\n return;\r\n }\r\n\r\n // If clicking on button that open panel - don't trigger outside click processing\r\n if (buttonRef?.current && buttonRef?.current.contains(event.target as Node)) {\r\n return;\r\n }\r\n\r\n // If clicking the panel, this is not an outside clicked\r\n if (panelRef.current && panelRef?.current.contains(event.target as Node)) {\r\n return;\r\n }\r\n\r\n // If we reach this point, we got an outside clicked, no close the popup\r\n setIsSettingsOpen(false);\r\n\r\n }, [isInsideCoreDialog]);\r\n\r\n return (\r\n <>\r\n <Button disabled={props.disabled} styleType=\"borderless\" title={buttonTooltip} className=\"maplayers-settings-popup-button\" onClick={togglePopupDisplay} ref={buttonRef}>\r\n <WebFontIcon iconName=\"icon-settings\" />\r\n </Button>\r\n <Popup\r\n isOpen={isSettingsOpen}\r\n position={RelativePosition.BottomRight}\r\n onClose={handleCloseSetting}\r\n target={buttonRef.current}\r\n onOutsideClick={handleOutsideClick}\r\n repositionOnResize={true}\r\n >\r\n <div ref={panelRef} className=\"maplayers-settings-popup-panel\">\r\n <MapManagerSettings />\r\n </div>\r\n </Popup >\r\n </ >\r\n );\r\n}\r\n"]}
@@ -8,7 +8,8 @@ export interface TransparencyPopupButtonProps {
8
8
  onTransparencyChange(value: number): void;
9
9
  /** optional tooltip */
10
10
  buttonToolTip?: string;
11
+ disabled?: boolean;
11
12
  }
12
13
  /** @alpha */
13
- export declare function TransparencyPopupButton({ transparency, onTransparencyChange, buttonToolTip }: TransparencyPopupButtonProps): JSX.Element;
14
+ export declare function TransparencyPopupButton({ transparency, onTransparencyChange, buttonToolTip, disabled }: TransparencyPopupButtonProps): JSX.Element;
14
15
  //# sourceMappingURL=TransparencyPopupButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TransparencyPopupButton.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/TransparencyPopupButton.tsx"],"names":[],"mappings":";AAWA,OAAO,gCAAgC,CAAC;AAExC,aAAa;AACb,MAAM,WAAW,4BAA4B;IAC3C,6BAA6B;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C,uBAAuB;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,aAAa;AAEb,wBAAgB,uBAAuB,CAAC,EAAE,YAAY,EAAE,oBAAoB,EAAE,aAAa,EAAE,EAAE,4BAA4B,eAgD1H"}
1
+ {"version":3,"file":"TransparencyPopupButton.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/TransparencyPopupButton.tsx"],"names":[],"mappings":";AAWA,OAAO,gCAAgC,CAAC;AAExC,aAAa;AACb,MAAM,WAAW,4BAA4B;IAC3C,6BAA6B;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C,uBAAuB;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,aAAa;AAEb,wBAAgB,uBAAuB,CAAC,EAAE,YAAY,EAAE,oBAAoB,EAAE,aAAa,EAAE,QAAQ,EAAE,EAAE,4BAA4B,eAgDpI"}
@@ -10,7 +10,7 @@ import { Button, Slider } from "@itwin/itwinui-react";
10
10
  import "./TransparencyPopupButton.scss";
11
11
  /** @alpha */
12
12
  // eslint-disable-next-line @typescript-eslint/naming-convention
13
- export function TransparencyPopupButton({ transparency, onTransparencyChange, buttonToolTip }) {
13
+ export function TransparencyPopupButton({ transparency, onTransparencyChange, buttonToolTip, disabled }) {
14
14
  const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);
15
15
  const [defaultTransparencyLabel] = React.useState(IModelApp.localization.getLocalizedString("mapLayers:TransparencyPopup.SetTransparency"));
16
16
  const toolTipLabel = React.useMemo(() => buttonToolTip ? buttonToolTip : defaultTransparencyLabel, [buttonToolTip, defaultTransparencyLabel]);
@@ -32,9 +32,9 @@ export function TransparencyPopupButton({ transparency, onTransparencyChange, bu
32
32
  }
33
33
  }, [onTransparencyChange, transparency]);
34
34
  return (React.createElement(React.Fragment, null,
35
- React.createElement(Button, { size: "small", styleType: "borderless", title: toolTipLabel, className: "map-transparency-popup-button", onClick: togglePopupDisplay, ref: buttonRef },
35
+ React.createElement(Button, { disabled: disabled, size: "small", styleType: "borderless", title: toolTipLabel, className: "map-transparency-popup-button", onClick: togglePopupDisplay, ref: buttonRef },
36
36
  React.createElement("div", { className: "transparent-button" },
37
- React.createElement("svg", { className: "checkered", viewBox: "0 0 24 24" },
37
+ React.createElement("svg", { className: disabled ? "checkered-disabled" : "checkered", viewBox: "0 0 24 24" },
38
38
  React.createElement("path", { d: "m21.00427 0h-18.00854a2.9957 2.9957 0 0 0 -2.99573 2.99567v18.0086a2.99575 2.99575 0 0 0 2.99573 2.99573h18.00854a2.99575 2.99575 0 0 0 2.99573-2.99573v-18.0086a2.9957 2.9957 0 0 0 -2.99573-2.99567zm-20.00427 21.00427v-9.00427h11v-11h9.00427a1.998 1.998 0 0 1 1.99573 1.99567v9.00433h-11v11h-9.00427a1.998 1.998 0 0 1 -1.99573-1.99573z" })))),
39
39
  React.createElement(Popup, { isOpen: isSettingsOpen, position: RelativePosition.BottomRight, onClose: handleCloseSetting, target: buttonRef.current },
40
40
  React.createElement("div", { className: "map-transparency-popup-panel" },
@@ -1 +1 @@
1
- {"version":3,"file":"TransparencyPopupButton.js","sourceRoot":"","sources":["../../../../src/ui/widget/TransparencyPopupButton.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,gCAAgC,CAAC;AAYxC,aAAa;AACb,gEAAgE;AAChE,MAAM,UAAU,uBAAuB,CAAC,EAAE,YAAY,EAAE,oBAAoB,EAAE,aAAa,EAAgC;IACzH,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClE,MAAM,CAAC,wBAAwB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,YAAY,CAAC,kBAAkB,CAAC,6CAA6C,CAAC,CAAC,CAAC;IAC5I,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAA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AiV,GAAG,CACxV,CACF,CACC;QACT,oBAAC,KAAK,IACJ,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,gBAAgB,CAAC,WAAW,EACtC,OAAO,EAAE,kBAAkB,EAC3B,MAAM,EAAE,SAAS,CAAC,OAAO;YAEzB,6BAAK,SAAS,EAAC,8BAA8B;gBAC3C,6BAAK,SAAS,EAAC,mCAAmC;oBAChD,oBAAC,MAAM,IAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,YAAY,GAAG,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,wBAAwB,GAAI,CACnG,CACF,CACC,CACP,CACL,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport * as React from \"react\";\r\nimport { RelativePosition } from \"@itwin/appui-abstract\";\r\nimport { IModelApp } from \"@itwin/core-frontend\";\r\nimport { Popup } from \"@itwin/core-react\";\r\nimport { Button, Slider } from \"@itwin/itwinui-react\";\r\n\r\nimport \"./TransparencyPopupButton.scss\";\r\n\r\n/** @alpha */\r\nexport interface TransparencyPopupButtonProps {\r\n /** initialValue range 0-1 */\r\n transparency: number;\r\n /** function called when value changes. Returned value range 0-1 */\r\n onTransparencyChange(value: number): void;\r\n /** optional tooltip */\r\n buttonToolTip?: string;\r\n}\r\n\r\n/** @alpha */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function TransparencyPopupButton({ transparency, onTransparencyChange, buttonToolTip }: TransparencyPopupButtonProps) {\r\n const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);\r\n const [defaultTransparencyLabel] = React.useState(IModelApp.localization.getLocalizedString(\"mapLayers:TransparencyPopup.SetTransparency\"));\r\n const toolTipLabel = React.useMemo(() => buttonToolTip ? buttonToolTip : defaultTransparencyLabel, [buttonToolTip, defaultTransparencyLabel]);\r\n\r\n const buttonRef = React.useRef<HTMLButtonElement>(null);\r\n const togglePopupDisplay = React.useCallback((event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\r\n event.preventDefault();\r\n setIsSettingsOpen((prev) => !prev);\r\n }, [setIsSettingsOpen]);\r\n\r\n const handleCloseSetting = React.useCallback(() => {\r\n setIsSettingsOpen(false);\r\n }, [setIsSettingsOpen]);\r\n\r\n const handleTransparencyChange = React.useCallback((values: readonly number[]) => {\r\n if (values.length) {\r\n const newTransparency = values[0];\r\n if (newTransparency !== transparency) {\r\n if (onTransparencyChange)\r\n onTransparencyChange(newTransparency / 100);\r\n }\r\n }\r\n }, [onTransparencyChange, transparency]);\r\n\r\n return (\r\n <>\r\n <Button size=\"small\" styleType=\"borderless\" title={toolTipLabel} className=\"map-transparency-popup-button\" onClick={togglePopupDisplay} ref={buttonRef}>\r\n <div className=\"transparent-button\">\r\n <svg className=\"checkered\" viewBox=\"0 0 24 24\">\r\n <path d=\"m21.00427 0h-18.00854a2.9957 2.9957 0 0 0 -2.99573 2.99567v18.0086a2.99575 2.99575 0 0 0 2.99573 2.99573h18.00854a2.99575 2.99575 0 0 0 2.99573-2.99573v-18.0086a2.9957 2.9957 0 0 0 -2.99573-2.99567zm-20.00427 21.00427v-9.00427h11v-11h9.00427a1.998 1.998 0 0 1 1.99573 1.99567v9.00433h-11v11h-9.00427a1.998 1.998 0 0 1 -1.99573-1.99573z\" />\r\n </svg>\r\n </div>\r\n </Button>\r\n <Popup\r\n isOpen={isSettingsOpen}\r\n position={RelativePosition.BottomRight}\r\n onClose={handleCloseSetting}\r\n target={buttonRef.current}\r\n >\r\n <div className=\"map-transparency-popup-panel\">\r\n <div className=\"map-transparency-slider-container\">\r\n <Slider min={0} max={100} values={[transparency * 100]} step={1} onChange={handleTransparencyChange} />\r\n </div>\r\n </div>\r\n </Popup >\r\n </ >\r\n );\r\n}\r\n"]}
1
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AC,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,wBAAwB,GAAI,CACnG,CACF,CACC,CACP,CACL,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport * as React from \"react\";\r\nimport { RelativePosition } from \"@itwin/appui-abstract\";\r\nimport { IModelApp } from \"@itwin/core-frontend\";\r\nimport { Popup } from \"@itwin/core-react\";\r\nimport { Button, Slider } from \"@itwin/itwinui-react\";\r\n\r\nimport \"./TransparencyPopupButton.scss\";\r\n\r\n/** @alpha */\r\nexport interface TransparencyPopupButtonProps {\r\n /** initialValue range 0-1 */\r\n transparency: number;\r\n /** function called when value changes. Returned value range 0-1 */\r\n onTransparencyChange(value: number): void;\r\n /** optional tooltip */\r\n buttonToolTip?: string;\r\n disabled?: boolean;\r\n}\r\n\r\n/** @alpha */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function TransparencyPopupButton({ transparency, onTransparencyChange, buttonToolTip, disabled }: TransparencyPopupButtonProps) {\r\n const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);\r\n const [defaultTransparencyLabel] = React.useState(IModelApp.localization.getLocalizedString(\"mapLayers:TransparencyPopup.SetTransparency\"));\r\n const toolTipLabel = React.useMemo(() => buttonToolTip ? buttonToolTip : defaultTransparencyLabel, [buttonToolTip, defaultTransparencyLabel]);\r\n\r\n const buttonRef = React.useRef<HTMLButtonElement>(null);\r\n const togglePopupDisplay = React.useCallback((event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\r\n event.preventDefault();\r\n setIsSettingsOpen((prev) => !prev);\r\n }, [setIsSettingsOpen]);\r\n\r\n const handleCloseSetting = React.useCallback(() => {\r\n setIsSettingsOpen(false);\r\n }, [setIsSettingsOpen]);\r\n\r\n const handleTransparencyChange = React.useCallback((values: readonly number[]) => {\r\n if (values.length) {\r\n const newTransparency = values[0];\r\n if (newTransparency !== transparency) {\r\n if (onTransparencyChange)\r\n onTransparencyChange(newTransparency / 100);\r\n }\r\n }\r\n }, [onTransparencyChange, transparency]);\r\n\r\n return (\r\n <>\r\n <Button disabled={disabled} size=\"small\" styleType=\"borderless\" title={toolTipLabel} className=\"map-transparency-popup-button\" onClick={togglePopupDisplay} ref={buttonRef}>\r\n <div className=\"transparent-button\">\r\n <svg className={disabled ? \"checkered-disabled\": \"checkered\"} viewBox=\"0 0 24 24\">\r\n <path d=\"m21.00427 0h-18.00854a2.9957 2.9957 0 0 0 -2.99573 2.99567v18.0086a2.99575 2.99575 0 0 0 2.99573 2.99573h18.00854a2.99575 2.99575 0 0 0 2.99573-2.99573v-18.0086a2.9957 2.9957 0 0 0 -2.99573-2.99567zm-20.00427 21.00427v-9.00427h11v-11h9.00427a1.998 1.998 0 0 1 1.99573 1.99567v9.00433h-11v11h-9.00427a1.998 1.998 0 0 1 -1.99573-1.99573z\" />\r\n </svg>\r\n </div>\r\n </Button>\r\n <Popup\r\n isOpen={isSettingsOpen}\r\n position={RelativePosition.BottomRight}\r\n onClose={handleCloseSetting}\r\n target={buttonRef.current}\r\n >\r\n <div className=\"map-transparency-popup-panel\">\r\n <div className=\"map-transparency-slider-container\">\r\n <Slider min={0} max={100} values={[transparency * 100]} step={1} onChange={handleTransparencyChange} />\r\n </div>\r\n </div>\r\n </Popup >\r\n </ >\r\n );\r\n}\r\n"]}
@@ -22,12 +22,16 @@
22
22
 
23
23
 
24
24
  .map-transparency-popup-button {
25
- .transparent-button {
26
- width: 16px;
27
- height: 16px;
28
- }
25
+ .transparent-button {
26
+ width: 16px;
27
+ height: 16px;
28
+ }
29
29
 
30
- svg.checkered {
31
- fill: $buic-foreground-body;
32
- }
30
+ svg.checkered {
31
+ fill: $buic-foreground-body;
32
+ }
33
+
34
+ svg.checkered-disabled {
35
+ fill: $buic-foreground-muted;
36
+ }
33
37
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/map-layers",
3
- "version": "3.4.0-dev.9",
3
+ "version": "3.5.0-dev.4",
4
4
  "description": "Extension that adds a Map Layers Widget",
5
5
  "main": "lib/cjs/map-layers.js",
6
6
  "module": "lib/esm/map-layers.js",
@@ -21,28 +21,28 @@
21
21
  "url": "http://www.bentley.com"
22
22
  },
23
23
  "devDependencies": {
24
- "@itwin/appui-abstract": "3.4.0-dev.9",
25
- "@itwin/appui-layout-react": "3.4.0-dev.9",
26
- "@itwin/appui-react": "3.4.0-dev.9",
27
- "@itwin/build-tools": "3.4.0-dev.9",
28
- "@itwin/components-react": "3.4.0-dev.9",
29
- "@itwin/core-bentley": "3.4.0-dev.9",
30
- "@itwin/core-common": "3.4.0-dev.9",
31
- "@itwin/core-frontend": "3.4.0-dev.9",
32
- "@itwin/core-geometry": "3.4.0-dev.9",
33
- "@itwin/core-quantity": "3.4.0-dev.9",
34
- "@itwin/core-react": "3.4.0-dev.9",
35
- "@itwin/eslint-plugin": "3.4.0-dev.9",
36
- "@itwin/imodel-components-react": "3.4.0-dev.9",
24
+ "@itwin/appui-abstract": "3.5.0-dev.4",
25
+ "@itwin/appui-layout-react": "3.5.0-dev.4",
26
+ "@itwin/appui-react": "3.5.0-dev.4",
27
+ "@itwin/build-tools": "3.5.0-dev.4",
28
+ "@itwin/components-react": "3.5.0-dev.4",
29
+ "@itwin/core-bentley": "3.5.0-dev.4",
30
+ "@itwin/core-common": "3.5.0-dev.4",
31
+ "@itwin/core-frontend": "3.5.0-dev.4",
32
+ "@itwin/core-geometry": "3.5.0-dev.4",
33
+ "@itwin/core-quantity": "3.5.0-dev.4",
34
+ "@itwin/core-react": "3.5.0-dev.4",
35
+ "@itwin/eslint-plugin": "3.5.0-dev.4",
36
+ "@itwin/imodel-components-react": "3.5.0-dev.4",
37
37
  "@itwin/itwinui-css": "0.x",
38
- "@itwin/itwinui-react": "^1.38.1",
39
- "@itwin/presentation-common": "3.4.0-dev.9",
38
+ "@itwin/itwinui-react": "~1.42.0",
39
+ "@itwin/presentation-common": "3.5.0-dev.4",
40
40
  "@testing-library/react": "^12.0.0",
41
41
  "@testing-library/react-hooks": "^7.0.2",
42
42
  "@types/chai": "4.3.1",
43
43
  "@types/enzyme": "3.9.3",
44
44
  "@types/mocha": "^8.2.2",
45
- "@types/node": "16.11.7",
45
+ "@types/node": "16.11.59",
46
46
  "@types/react": "^17.0.37",
47
47
  "@types/react-beautiful-dnd": "^12.1.2",
48
48
  "@types/sinon": "^9.0.0",
@@ -73,17 +73,17 @@
73
73
  "react-beautiful-dnd": "^13.0.0"
74
74
  },
75
75
  "peerDependencies": {
76
- "@itwin/core-bentley": "^3.4.0-dev.9",
77
- "@itwin/core-geometry": "^3.4.0-dev.9",
78
- "@itwin/core-common": "^3.4.0-dev.9",
79
- "@itwin/core-frontend": "^3.4.0-dev.9",
80
- "@itwin/core-quantity": "^3.4.0-dev.9",
81
- "@itwin/appui-abstract": "^3.4.0-dev.9",
82
- "@itwin/components-react": "^3.4.0-dev.9",
83
- "@itwin/core-react": "^3.4.0-dev.9",
84
- "@itwin/appui-react": "^3.4.0-dev.9",
85
- "@itwin/imodel-components-react": "^3.4.0-dev.9",
86
- "@itwin/appui-layout-react": "^3.4.0-dev.9",
76
+ "@itwin/core-bentley": "^3.5.0-dev.4",
77
+ "@itwin/core-geometry": "^3.5.0-dev.4",
78
+ "@itwin/core-common": "^3.5.0-dev.4",
79
+ "@itwin/core-frontend": "^3.5.0-dev.4",
80
+ "@itwin/core-quantity": "^3.5.0-dev.4",
81
+ "@itwin/appui-abstract": "^3.5.0-dev.4",
82
+ "@itwin/components-react": "^3.5.0-dev.4",
83
+ "@itwin/core-react": "^3.5.0-dev.4",
84
+ "@itwin/appui-react": "^3.5.0-dev.4",
85
+ "@itwin/imodel-components-react": "^3.5.0-dev.4",
86
+ "@itwin/appui-layout-react": "^3.5.0-dev.4",
87
87
  "react": "^17.0.0",
88
88
  "react-dom": "^17.0.0"
89
89
  },
@@ -95,7 +95,7 @@
95
95
  "plugins": [
96
96
  "@itwin"
97
97
  ],
98
- "extends": "plugin:@itwin/itwinjs-recommended"
98
+ "extends": "plugin:@itwin/ui"
99
99
  },
100
100
  "mocha": {
101
101
  "require": [