diff --git a/src/api/layer-set.ts b/src/api/layer-set.ts index 92262d9b..c436532c 100644 --- a/src/api/layer-set.ts +++ b/src/api/layer-set.ts @@ -26,7 +26,7 @@ import Geometry from 'ol/geom/Geometry'; import UrlTile from 'ol/source/UrlTile'; import { LoadFunction as TileLoadFunction } from 'ol/Tile'; import { MapGuideMockMode } from '../components/mapguide-debug-context'; -import { BLANK_GIF_DATA_URI, LAYER_ID_BASE, LAYER_ID_MG_BASE, LAYER_ID_MG_SEL_OVERLAY } from '../constants'; +import { BLANK_GIF_DATA_URI, LAYER_ID_BASE, LAYER_ID_MG_BASE, LAYER_ID_MG_DYNAMIC_OVERLAY, LAYER_ID_MG_SEL_OVERLAY } from '../constants'; import { OLImageLayer, OLTileLayer } from './ol-types'; import { IGenericSubjectMapLayer } from '../actions/defs'; import { GenericLayerSetOL } from './generic-layer-set'; @@ -321,14 +321,19 @@ export class MgLayerSetOL implements ILayerSetOL { } } + if (LAYER_ID_MG_DYNAMIC_OVERLAY in trans) { + const opacity = restrictToRange(trans[LAYER_ID_MG_DYNAMIC_OVERLAY], 0, 1.0); + this.overlay.setOpacity(opacity); + } else { + this.overlay.setOpacity(1.0); + } + if (LAYER_ID_MG_BASE in trans) { const opacity = restrictToRange(trans[LAYER_ID_MG_BASE], 0, 1.0); - this.overlay.setOpacity(opacity); for (const group of this.mgTiledLayers) { group.setOpacity(opacity); } } else { - this.overlay.setOpacity(1.0); for (const group of this.mgTiledLayers) { group.setOpacity(1.0); } diff --git a/src/constants.ts b/src/constants.ts index b41f1f7f..9541f517 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -19,6 +19,10 @@ export const FUSION_REDLINE_NAME = "Redline"; export const LAYER_ID_BASE = "LAYER_ID_BASE"; export const LAYER_ID_MG_BASE = "LAYER_ID_MG_BASE"; +/** + * @since 0.14.8 + */ +export const LAYER_ID_MG_DYNAMIC_OVERLAY = "LAYER_ID_MG_DYNAMIC_OVERLAY"; export const LAYER_ID_MG_SEL_OVERLAY = "LAYER_ID_MG_SEL_OVERLAY"; export const BLANK_GIF_DATA_URI = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="; \ No newline at end of file diff --git a/src/containers/viewer-options.tsx b/src/containers/viewer-options.tsx index 5ba8a3ac..d83e377a 100644 --- a/src/containers/viewer-options.tsx +++ b/src/containers/viewer-options.tsx @@ -9,7 +9,7 @@ import { Slider, HTMLSelect } from '@blueprintjs/core'; import { useActiveMapName, useViewerFeatureTooltipsEnabled, useConfiguredManualFeatureTooltips, useViewerSizeUnits, useViewerLocale, useActiveMapExternalBaseLayers, useViewerIsStateless, useViewerSelectCanDragPan } from './hooks'; import { setManualFeatureTooltipsEnabled, setFeatureTooltipsEnabled, setLayerTransparency, setViewSizeUnits, enableSelectDragPan } from '../actions/map'; import { useActiveMapLayerTransparency, useActiveMapState } from './hooks-mapguide'; -import { LAYER_ID_BASE, LAYER_ID_MG_BASE, LAYER_ID_MG_SEL_OVERLAY } from '../constants'; +import { LAYER_ID_BASE, LAYER_ID_MG_BASE, LAYER_ID_MG_DYNAMIC_OVERLAY, LAYER_ID_MG_SEL_OVERLAY } from '../constants'; import { useReduxDispatch } from "../components/map-providers/context"; import { isRuntimeMap } from "../utils/type-guards"; @@ -42,6 +42,9 @@ export const ViewerOptions = () => { const onBaseOpacityChanged = (value: number) => { onMgLayerOpacityChanged(mapName, LAYER_ID_BASE, value); }; + const onMgDynamicOverlayOpacityChanged = (value: number) => { + onMgLayerOpacityChanged(mapName, LAYER_ID_MG_DYNAMIC_OVERLAY, value); + } const onMgOpacityChanged = (value: number) => { onMgLayerOpacityChanged(mapName, LAYER_ID_MG_BASE, value); }; @@ -64,6 +67,7 @@ export const ViewerOptions = () => { let opBase = 1.0; let opMgBase = 1.0; let opMgSelOverlay = 1.0; + let opMgDynamicOverlay = 1.0; if (layerTransparency) { if (LAYER_ID_BASE in layerTransparency) { opBase = layerTransparency[LAYER_ID_BASE]; @@ -71,13 +75,19 @@ export const ViewerOptions = () => { if (LAYER_ID_MG_BASE in layerTransparency) { opMgBase = layerTransparency[LAYER_ID_MG_BASE]; } + if (LAYER_ID_MG_DYNAMIC_OVERLAY in layerTransparency) { + opMgDynamicOverlay = layerTransparency[LAYER_ID_MG_DYNAMIC_OVERLAY]; + } if (LAYER_ID_MG_SEL_OVERLAY in layerTransparency) { opMgSelOverlay = layerTransparency[LAYER_ID_MG_SEL_OVERLAY]; } } + let hasMgBaseLayers = false; let isStateless = stateless; if (!map) { isStateless = true; + } else { + hasMgBaseLayers = (map.FiniteDisplayScale?.length ?? 0) > 0; } return
{tr("VIEWER_OPTIONS", locale)}
@@ -113,10 +123,16 @@ export const ViewerOptions = () => { ; } })()} + {hasMgBaseLayers && } {!isStateless &&