diff --git a/src/app/OlMap/Controls/StyleEditorPanel.tsx b/src/app/OlMap/Controls/StyleEditorPanel.tsx index 780b51e..6206083 100644 --- a/src/app/OlMap/Controls/StyleEditorPanel.tsx +++ b/src/app/OlMap/Controls/StyleEditorPanel.tsx @@ -359,7 +359,9 @@ const StyleEditorPanel: React.FC = ({ setJunctionText(property); setShowJunctionTextLayer(styleConfig.showLabels); setApplyJunctionStyle(true); - setContourLayerAvailable && setContourLayerAvailable(true); + if (property === "pressure" && setContourLayerAvailable) { + setContourLayerAvailable(true); + } saveLayerStyle(layerId); open?.({ type: "success", diff --git a/src/app/OlMap/MapComponent.tsx b/src/app/OlMap/MapComponent.tsx index be2b13d..8533931 100644 --- a/src/app/OlMap/MapComponent.tsx +++ b/src/app/OlMap/MapComponent.tsx @@ -155,7 +155,7 @@ const MapComponent: React.FC = ({ children }) => { return false; }); if (uniqueNewData.length > 0) { - setJunctionDataState((prev) => [...prev, ...uniqueNewData]); + setJunctionDataState((prev) => prev.concat(uniqueNewData)); } }; const setPipeData = (newData: any[]) => { @@ -168,7 +168,7 @@ const MapComponent: React.FC = ({ children }) => { return false; }); if (uniqueNewData.length > 0) { - setPipeDataState((prev) => [...prev, ...uniqueNewData]); + setPipeDataState((prev) => prev.concat(uniqueNewData)); } }; // 配置地图数据源、图层和样式 @@ -422,7 +422,9 @@ const MapComponent: React.FC = ({ children }) => { const uniqueData = Array.from(data.values()); if (uniqueData.length > 0) { - tileJunctionDataBuffer.current.push(...uniqueData); + uniqueData.forEach((item) => + tileJunctionDataBuffer.current.push(item) + ); debouncedUpdateData.current(); } } @@ -501,7 +503,7 @@ const MapComponent: React.FC = ({ children }) => { const uniqueData = Array.from(data.values()); if (uniqueData.length > 0) { - tilePipeDataBuffer.current.push(...uniqueData); + uniqueData.forEach((item) => tilePipeDataBuffer.current.push(item)); debouncedUpdateData.current(); } } @@ -581,7 +583,7 @@ const MapComponent: React.FC = ({ children }) => { projection: "EPSG:3857", }), // 图层依面、线、点、标注次序添加 - layers: [...availableLayers], + layers: availableLayers.slice(), controls: [], }); setMap(map); @@ -816,9 +818,7 @@ const MapComponent: React.FC = ({ children }) => { pipeText, contours, ]); - useEffect(() => { - console.log("Contour Layer Available:", isContourLayerAvailable); - }, [isContourLayerAvailable]); + // 控制流动动画开关 useEffect(() => { if (pipeText === "flow" && currentPipeCalData.length > 0) { @@ -940,7 +940,7 @@ const MapComponent: React.FC = ({ children }) => { flowFlag: pipeProperties === "flow" && record.value < 0 ? -1 : 1, path: pipeProperties === "flow" && record.value < 0 && p.flowFlag > 0 - ? [...p.path].reverse() + ? p.path.slice().reverse() : p.path, // 流量数值 [pipeProperties]: