Browse Source

地图布局简单修改

zhaojijng 2 years ago
parent
commit
5f78d6a173
2 changed files with 5 additions and 4 deletions
  1. 2 2
      src/layouts/index.less
  2. 3 2
      src/sgcomponents/map/index.tsx

+ 2 - 2
src/layouts/index.less

@@ -1,9 +1,9 @@
 .layout {
   box-sizing: border-box;
-  width: 1340px;
+  //   width: 1340px;
   height: 100%;
   margin: 0 auto;
-  padding: 20px;
+  padding: 20px 50px;
   user-select: none;
 }
 

+ 3 - 2
src/sgcomponents/map/index.tsx

@@ -109,9 +109,10 @@ const Map: React.FC<MapProps> = ({ type, selFloorId, render, mapList, mapSize })
     console.log('mscale', mscale);
   };
 
-  const fixWidth = 1300;
+  //const fixWidth = 1300;
   useEffect(() => {
-    var scale = Number((fixWidth / mapSize.width).toFixed(4));
+    var mapWrapWidth = (mapRef.current || {}).clientWidth || 0;
+    var scale = Number((mapWrapWidth / mapSize.width).toFixed(4));
     setMscale(scale);
     if (scale < 0.3) {
       console.log('mscale', mscale);