|
|
@@ -2,7 +2,7 @@
|
|
|
<div
|
|
|
id="tracking-map"
|
|
|
ref="mapContainer"
|
|
|
- style="width: 100%; height: 520px"
|
|
|
+ style="width: 100%; height: 448px"
|
|
|
class="tracking-map"
|
|
|
:class="{ 'dark-mode': themeStore.theme === 'dark' }"
|
|
|
></div>
|
|
|
@@ -277,7 +277,6 @@ let visibleMarkers = new Set()
|
|
|
|
|
|
// 添加标记后更新中心和缩放级别
|
|
|
const addMarkersToMap = () => {
|
|
|
- // debugger
|
|
|
if (!map) return // 确保地图已经初始化
|
|
|
|
|
|
markerPositions.value.forEach((position) => {
|
|
|
@@ -307,7 +306,7 @@ const addMarkersToMap = () => {
|
|
|
if (viewData.value.length > 0) {
|
|
|
// 根据标记的位置设置中心点以及缩放级别
|
|
|
const bounds = L.latLngBounds(viewData.value)
|
|
|
- map!.fitBounds(bounds, { paddingTopLeft: [20, 70], paddingBottomRight: [400, 0] })
|
|
|
+ map!.fitBounds(bounds, { paddingTopLeft: [20, 70], paddingBottomRight: [0, 0] })
|
|
|
setTimeout(() => {
|
|
|
if (isFirstRender) {
|
|
|
initialCenter = map!.getCenter()
|
|
|
@@ -315,7 +314,7 @@ const addMarkersToMap = () => {
|
|
|
isFirstRender = false
|
|
|
}
|
|
|
addResetZoomButton(initialCenter!, initialZoomLevel!)
|
|
|
- }, 0)
|
|
|
+ }, 1000)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -349,7 +348,6 @@ const addShipMarker = (x: number) => {
|
|
|
// 获取线段的最后一个点和倒数第二个点
|
|
|
const lastPoint = solidLine[solidLine.length - 1]
|
|
|
const secondLastPoint = solidLine[solidLine.length - 2]
|
|
|
- console.log(lastPoint, secondLastPoint, 'lastPoint, secondLastPoint')
|
|
|
// 计算线段末端的角度(以弧度为单位)
|
|
|
const angle =
|
|
|
(Math.atan2(
|
|
|
@@ -485,8 +483,8 @@ const getMarker = () => {
|
|
|
Transfer: { color: '#ed0000', icon: transferIcon }
|
|
|
}
|
|
|
markerPositions.value.push({
|
|
|
- lat: item.lat,
|
|
|
- lng: (Number(item.lng) + 360) % 360,
|
|
|
+ lat: Number(item.lat),
|
|
|
+ lng: Number(item.lng),
|
|
|
city: item.infor,
|
|
|
label: item.label,
|
|
|
icon: iconColorList[item.label].icon,
|
|
|
@@ -495,7 +493,7 @@ const getMarker = () => {
|
|
|
})
|
|
|
viewData.value = (data?.rangePoint.length > 0 ? data?.rangePoint : data?.point)?.map(
|
|
|
(item) => {
|
|
|
- return [Number(item.lat), (Number(item.lon || item.lng) + 360) % 360]
|
|
|
+ return [Number(item.lat), Number(item.lon || item.lng)]
|
|
|
}
|
|
|
)
|
|
|
// 请求成功后添加标记,并动态添加重置按钮
|
|
|
@@ -539,6 +537,7 @@ onUnmounted(() => {
|
|
|
<style lang="scss">
|
|
|
@import 'leaflet/dist/leaflet.css';
|
|
|
.tracking-map {
|
|
|
+ border-radius: 12px;
|
|
|
.leaflet-popup-content-wrapper {
|
|
|
border-radius: 6px;
|
|
|
}
|
|
|
@@ -584,6 +583,12 @@ onUnmounted(() => {
|
|
|
height: 26px;
|
|
|
font-size: 18px;
|
|
|
}
|
|
|
+ a.leaflet-control-zoom-in,
|
|
|
+ a.leaflet-control-zoom-out {
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ }
|
|
|
}
|
|
|
.dark-mode {
|
|
|
div.leaflet-control-zoom.leaflet-bar.leaflet-control {
|
|
|
@@ -591,7 +596,7 @@ onUnmounted(() => {
|
|
|
border-radius: 4px;
|
|
|
box-shadow: none;
|
|
|
a {
|
|
|
- background-color: #3c414a;
|
|
|
+ background-color: #2b2f36;
|
|
|
border-bottom: none;
|
|
|
span {
|
|
|
color: var(--color-neutral-1);
|
|
|
@@ -600,17 +605,18 @@ onUnmounted(() => {
|
|
|
span {
|
|
|
display: inline-block;
|
|
|
width: 24px;
|
|
|
- border-bottom: 2px solid #575c64;
|
|
|
+ height: 28px;
|
|
|
+ border-bottom: 1px solid #3f434a;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
.reset-zoom-control {
|
|
|
border: none;
|
|
|
- background-color: #3c414a;
|
|
|
+ background-color: #2b2f36;
|
|
|
}
|
|
|
a.leaflet-bar-part {
|
|
|
- background-color: #3c414a;
|
|
|
+ background-color: #2b2f36;
|
|
|
border-radius: 4px;
|
|
|
box-shadow: none;
|
|
|
overflow: hidden;
|
|
|
@@ -625,7 +631,7 @@ onUnmounted(() => {
|
|
|
|
|
|
/* 示例:将所有地图图片的颜色反转 */
|
|
|
.dark-mode img:not(.leaflet-marker-icon) {
|
|
|
- filter: invert(1) hue-rotate(170deg);
|
|
|
+ filter: invert(1) hue-rotate(230deg) saturate(60%) brightness(60%) opacity(80%);
|
|
|
}
|
|
|
// 防止暗黑模式下地图超出容器
|
|
|
.tracking-map {
|