= ({ hiddenButtons }) => {
const map = useMap();
const data = useData();
if (!data) return null;
@@ -548,24 +552,30 @@ const Toolbar: React.FC = () => {
return (
<>
- }
- name="查看属性"
- isActive={activeTools.includes("info")}
- onClick={() => handleToolClick("info")}
- />
- }
- name="矢量编辑"
- isActive={activeTools.includes("draw")}
- onClick={() => handleToolClick("draw")}
- />
- }
- name="图层样式"
- isActive={activeTools.includes("style")}
- onClick={() => handleToolClick("style")}
- />
+ {!hiddenButtons?.includes("info") && (
+ }
+ name="查看属性"
+ isActive={activeTools.includes("info")}
+ onClick={() => handleToolClick("info")}
+ />
+ )}
+ {!hiddenButtons?.includes("draw") && (
+ }
+ name="矢量编辑"
+ isActive={activeTools.includes("draw")}
+ onClick={() => handleToolClick("draw")}
+ />
+ )}
+ {!hiddenButtons?.includes("style") && (
+ }
+ name="图层样式"
+ isActive={activeTools.includes("style")}
+ onClick={() => handleToolClick("style")}
+ />
+ )}
{showPropertyPanel && }
{showDrawPanel && map && }
diff --git a/src/app/OlMap/MapComponent.tsx b/src/app/OlMap/MapComponent.tsx
index 18bb866..2a9c2d0 100644
--- a/src/app/OlMap/MapComponent.tsx
+++ b/src/app/OlMap/MapComponent.tsx
@@ -632,6 +632,7 @@ const MapComponent: React.FC = ({ children }) => {
diff --git a/src/app/OlMap/MapTools.tsx b/src/app/OlMap/MapTools.tsx
index 7cbdac8..358b0f7 100644
--- a/src/app/OlMap/MapTools.tsx
+++ b/src/app/OlMap/MapTools.tsx
@@ -1,7 +1,6 @@
import React from "react";
import Zoom from "./Controls/Zoom";
import BaseLayers from "./Controls/BaseLayers";
-import MapToolbar from "./Controls/Toolbar";
import ScaleLine from "./Controls/ScaleLine";
import LayerControl from "./Controls/LayerControl";
interface MapToolsProps {}
@@ -12,7 +11,6 @@ const MapTools: React.FC = () => {
-
{/* 继续添加其他自定义控件 */}
>