From fddb0ceb34c4c88e201fca9873f2b6e082cde2ef Mon Sep 17 00:00:00 2001 From: Huarch Date: Thu, 16 Jul 2026 18:02:29 +0800 Subject: [PATCH] fix(map): restrict waterflow layer to flow --- .../olmap/core/Controls/useStyleEditor.ts | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/components/olmap/core/Controls/useStyleEditor.ts b/src/components/olmap/core/Controls/useStyleEditor.ts index efdd9b4..88183f7 100644 --- a/src/components/olmap/core/Controls/useStyleEditor.ts +++ b/src/components/olmap/core/Controls/useStyleEditor.ts @@ -60,6 +60,7 @@ export const useStyleEditor = ({ const setShowPipeId = data?.setShowPipeId; const setContourLayerAvailable = data?.setContourLayerAvailable; const setWaterflowLayerAvailable = data?.setWaterflowLayerAvailable; + const setShowWaterflowLayer = data?.setShowWaterflowLayer; const setJunctionText = data?.setJunctionText; const setPipeText = data?.setPipeText; const setContours = data?.setContours; @@ -557,11 +558,15 @@ export const useStyleEditor = ({ } if (layerId === "pipes") { + const isFlowProperty = property === "flow"; setPipeText?.(property); setShowPipeTextLayer?.(styleConfig.showLabels); setShowPipeId?.(styleConfig.showId); setApplyPipeStyle(true); - setWaterflowLayerAvailable?.(true); + setWaterflowLayerAvailable?.(isFlowProperty); + if (!isFlowProperty) { + setShowWaterflowLayer?.(false); + } saveLayerStyle(layerId); open?.({ type: "success", @@ -581,6 +586,7 @@ export const useStyleEditor = ({ setShowJunctionTextLayer, setShowPipeId, setShowPipeTextLayer, + setShowWaterflowLayer, setWaterflowLayerAvailable, styleConfig, ]); @@ -744,10 +750,14 @@ export const useStyleEditor = ({ setContourLayerAvailable?.(nextStyleConfig.property === "pressure"); setApplyJunctionStyle(true); } else { + const isFlowProperty = nextStyleConfig.property === "flow"; setPipeText?.(nextStyleConfig.property); setShowPipeTextLayer?.(nextStyleConfig.showLabels); setShowPipeId?.(nextStyleConfig.showId); - setWaterflowLayerAvailable?.(true); + setWaterflowLayerAvailable?.(isFlowProperty); + if (!isFlowProperty) { + setShowWaterflowLayer?.(false); + } setApplyPipeStyle(true); } @@ -769,6 +779,7 @@ export const useStyleEditor = ({ setShowJunctionTextLayer, setShowPipeId, setShowPipeTextLayer, + setShowWaterflowLayer, setWaterflowLayerAvailable, upsertLayerStyleState, ] @@ -991,9 +1002,12 @@ export const useStyleEditor = ({ setContourLayerAvailable?.( defaultJunctionStyleState.styleConfig.property === "pressure" ); - setWaterflowLayerAvailable?.( - defaultPipeStyleState.styleConfig.property === "flow" - ); + const isDefaultPipeFlow = + defaultPipeStyleState.styleConfig.property === "flow"; + setWaterflowLayerAvailable?.(isDefaultPipeFlow); + if (!isDefaultPipeFlow) { + setShowWaterflowLayer?.(false); + } setApplyJunctionStyle(true); setApplyPipeStyle(true); @@ -1014,6 +1028,7 @@ export const useStyleEditor = ({ setShowJunctionTextLayer, setShowPipeId, setShowPipeTextLayer, + setShowWaterflowLayer, setWaterflowLayerAvailable, ]);