fix: 修正一下bug #10
@ -34,13 +34,13 @@
|
||||
}
|
||||
|
||||
.top-panel-number {
|
||||
/* line-height: 60px; // 删除或注释掉这一行 */
|
||||
/* line-height: 60px; */
|
||||
font-size: 30px;
|
||||
border-right: 1px solid #eceff9;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center; /* 可选:让数字水平居中 */
|
||||
justify-content: center;
|
||||
}
|
||||
.top-panel-tips{
|
||||
line-height:30px;
|
||||
@ -153,7 +153,7 @@
|
||||
<body>
|
||||
<div class="layuimini-main">
|
||||
|
||||
<div class="layui-row layui-col-space30 flex-row" style="margin-bottom: 2em;">
|
||||
<div class="layui-row layui-col-space30 flex-row" style="margin-bottom: 1em;">
|
||||
<div class="layui-col-xs12 layui-col-md6">
|
||||
<div class="layui-card top-panel stats-panel">
|
||||
<div class="layui-card-header">设备数量</div>
|
||||
@ -399,24 +399,19 @@
|
||||
currentBaseLayer = mapLayers[mapType];
|
||||
map.getLayers().insertAt(0, currentBaseLayer);
|
||||
|
||||
// 更新我的位置标记,使用正确的坐标系
|
||||
updateMyLocationForMapType(mapType);
|
||||
|
||||
// 更新设备标记
|
||||
addDeviceMarkers();
|
||||
}
|
||||
|
||||
// 根据地图类型更新我的位置标记
|
||||
function updateMyLocationForMapType(mapType) {
|
||||
if (myLocationFeature) {
|
||||
// 获取原始坐标
|
||||
var originalCoords = myLocationFeature.get('originalCoords');
|
||||
if (originalCoords) {
|
||||
var lat = originalCoords.lat;
|
||||
var lon = originalCoords.lon;
|
||||
var coordinates;
|
||||
|
||||
// 根据地图类型进行坐标转换
|
||||
if (mapType === 'amap' || mapType === 'amap_satellite') {
|
||||
// 高德地图使用GCJ-02坐标系,需要转换
|
||||
var gcjCoord = transform(lat, lon);
|
||||
@ -426,17 +421,14 @@
|
||||
coordinates = ol.proj.fromLonLat([lon, lat]);
|
||||
}
|
||||
|
||||
// 更新位置标记的几何坐标
|
||||
myLocationFeature.getGeometry().setCoordinates(coordinates);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function addDeviceMarkers() {
|
||||
// 保存我的位置标记
|
||||
var savedMyLocationFeature = myLocationFeature;
|
||||
|
||||
// 清除现有标记
|
||||
vectorSource.clear();
|
||||
greenFeatures = [];
|
||||
orangeFeatures = [];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user