fix(map): restrict waterflow layer to flow
This commit is contained in:
@@ -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,
|
||||
]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user