提升extent变量状态;修改部分默认值
This commit is contained in:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user