提升extent变量状态;修改部分默认值

This commit is contained in:
JIANG
2026-02-11 13:53:56 +08:00
parent 8b6198a2ac
commit 2911b87fac
3 changed files with 12 additions and 7 deletions

View File

@@ -96,12 +96,15 @@ export const useData = () => {
};
const MapComponent: React.FC<MapComponentProps> = ({ children }) => {
const MAP_EXTENT = config.MAP_EXTENT as [number, number, number, number];
const MAP_URL = config.MAP_URL;
// Subscribe to project context for workspace changes
const project = useProject();
const MAP_WORKSPACE = project?.workspace || config.MAP_WORKSPACE;
const MAP_EXTENT = (project?.extent || config.MAP_EXTENT) as [
number,
number,
number,
number,
];
const MAP_URL = config.MAP_URL;
const MAP_VIEW_STORAGE_KEY = `${MAP_WORKSPACE}_map_view`; // 持久化 key
const mapRef = useRef<HTMLDivElement | null>(null);
@@ -464,7 +467,7 @@ const MapComponent: React.FC<MapComponentProps> = ({ children }) => {
const scadaLayer = new VectorLayer({
source: scadaSource,
style: scadaStyle,
// extent: extent, // 设置图层范围
extent: MAP_EXTENT, // 设置图层范围
maxZoom: 24,
minZoom: 11,
properties: {