feat: 地图样式调整
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="overview">
|
<div class="overview">
|
||||||
<div class="content-col-content" style="padding:0">
|
<div class="content-col-content" style="padding:0">
|
||||||
<div :id="'map' + (isFullscreen ? '-screen-' : '' ) + chartInfo.id " style="height: 100%; width: 100%" :style="theme=='dark'? 'filter: invert(1) hue-rotate(0.5turn);opacity: 0.75;': ''"></div>
|
<div :id="'map' + (isFullscreen ? '-screen-' : '' ) + chartInfo.id " style="height: 100%; width: 100%"></div>
|
||||||
</div>
|
</div>
|
||||||
<!--自定义地图鼠标悬浮提示dom,避免被overflow:hidden裁剪-->
|
<!--自定义地图鼠标悬浮提示dom,避免被overflow:hidden裁剪-->
|
||||||
<div :style="{'left': `${tooltip.x}px`, 'top': `${tooltip.y}px`}" class="my-pane" :class="'my-pane-' + chartId" v-if="tooltip.show">
|
<div :style="{'left': `${tooltip.x}px`, 'top': `${tooltip.y}px`}" class="my-pane" :class="'my-pane-' + chartId" v-if="tooltip.show">
|
||||||
@@ -64,12 +64,13 @@ import icon from 'leaflet/dist/images/marker-icon.png'
|
|||||||
import iconShadow from 'leaflet/dist/images/marker-shadow.png'
|
import iconShadow from 'leaflet/dist/images/marker-shadow.png'
|
||||||
import 'leaflet/dist/leaflet.css'
|
import 'leaflet/dist/leaflet.css'
|
||||||
import maplibregl from 'maplibre-gl'
|
import maplibregl from 'maplibre-gl'
|
||||||
import mapStyle from './mapStyle'
|
import mapAllStyle from './mapStyle'
|
||||||
const regNum = /^[0-9]+.?[0-9]*/
|
const regNum = /^[0-9]+.?[0-9]*/
|
||||||
export default {
|
export default {
|
||||||
name: 'chartMap',
|
name: 'chartMap',
|
||||||
mixins: [chartMixin, chartFormat],
|
mixins: [chartMixin, chartFormat],
|
||||||
data () {
|
data () {
|
||||||
|
const theme = localStorage.getItem(`nz-user-${localStorage.getItem('nz-user-id')}-theme`) || 'light'
|
||||||
return {
|
return {
|
||||||
map: null,
|
map: null,
|
||||||
tooltip: {
|
tooltip: {
|
||||||
@@ -78,7 +79,7 @@ export default {
|
|||||||
show: false
|
show: false
|
||||||
},
|
},
|
||||||
dcStat: {},
|
dcStat: {},
|
||||||
theme: localStorage.getItem(`nz-user-${localStorage.getItem('nz-user-id')}-theme`),
|
theme,
|
||||||
timer: null,
|
timer: null,
|
||||||
requestAnimationFrame: '',
|
requestAnimationFrame: '',
|
||||||
pbfUrl: {
|
pbfUrl: {
|
||||||
@@ -118,6 +119,7 @@ export default {
|
|||||||
const param = { paramKey: 'map_center_config' }
|
const param = { paramKey: 'map_center_config' }
|
||||||
this.$get('sysConfig', param).then(response => {
|
this.$get('sysConfig', param).then(response => {
|
||||||
if (response.code == 200) {
|
if (response.code == 200) {
|
||||||
|
const mapStyle = mapAllStyle[this.theme]
|
||||||
const mapConfig = JSON.parse(response.data.paramKey.map_center_config)
|
const mapConfig = JSON.parse(response.data.paramKey.map_center_config)
|
||||||
mapStyle.center = [Number(mapConfig.longitude), Number(mapConfig.latitude)]
|
mapStyle.center = [Number(mapConfig.longitude), Number(mapConfig.latitude)]
|
||||||
mapStyle.zoom = Number(mapConfig.zoom)
|
mapStyle.zoom = Number(mapConfig.zoom)
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -23,7 +23,7 @@
|
|||||||
// 引入Leaflet对象 挂载到Vue上,便于全局使用,也可以单独页面中单独引用
|
// 引入Leaflet对象 挂载到Vue上,便于全局使用,也可以单独页面中单独引用
|
||||||
import 'leaflet/dist/leaflet.css'
|
import 'leaflet/dist/leaflet.css'
|
||||||
import maplibregl from 'maplibre-gl'
|
import maplibregl from 'maplibre-gl'
|
||||||
import mapStyle from '@/components/chart/chart/mapStyle'
|
import mapAllStyle from '@/components/chart/chart/mapStyle'
|
||||||
export default {
|
export default {
|
||||||
name: 'latlngPicker',
|
name: 'latlngPicker',
|
||||||
props: {
|
props: {
|
||||||
@@ -33,7 +33,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
theme: localStorage.getItem(`nz-user-${localStorage.getItem('nz-user-id')}-theme`),
|
theme: localStorage.getItem(`nz-user-${localStorage.getItem('nz-user-id')}-theme`) || 'light',
|
||||||
lnglat: '',
|
lnglat: '',
|
||||||
oldlnglat: '',
|
oldlnglat: '',
|
||||||
mapParam: { longitude: 116.39, latitude: 39.9, zoom: 4, minZoom: 1, maxZoom: 7 },
|
mapParam: { longitude: 116.39, latitude: 39.9, zoom: 4, minZoom: 1, maxZoom: 7 },
|
||||||
@@ -55,16 +55,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
const arr = []
|
|
||||||
mapStyle.layers.forEach(item => {
|
|
||||||
if (item.layout['text-font']) {
|
|
||||||
const font = item.layout['text-font'].join(',')
|
|
||||||
if (arr.indexOf(font) === -1) {
|
|
||||||
arr.push(font)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
console.log(arr)
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initMap () {
|
initMap () {
|
||||||
@@ -73,6 +63,7 @@ export default {
|
|||||||
this.map = null
|
this.map = null
|
||||||
}
|
}
|
||||||
this.setLatlng()
|
this.setLatlng()
|
||||||
|
let mapStyle = mapAllStyle[this.theme]
|
||||||
mapStyle.center = [Number(this.mapParam.longitude), Number(this.mapParam.latitude)]
|
mapStyle.center = [Number(this.mapParam.longitude), Number(this.mapParam.latitude)]
|
||||||
mapStyle.zoom = Number(this.zoom)
|
mapStyle.zoom = Number(this.zoom)
|
||||||
const mapId = document.getElementById('map')
|
const mapId = document.getElementById('map')
|
||||||
|
|||||||
@@ -426,7 +426,7 @@ export default {
|
|||||||
const group = SVG().addTo(box).attr('id', key).size('255', '305')
|
const group = SVG().addTo(box).attr('id', key).size('255', '305')
|
||||||
group.attr('width', '265')
|
group.attr('width', '265')
|
||||||
group.attr('height', '305')
|
group.attr('height', '305')
|
||||||
group.attr('style', `left: ${coordinatePoint[key].offsetX};top:${coordinatePoint[key].offsetY};transform:scale(${this.zoom}) translate(0, -50px)`)
|
group.attr('style', `left: ${coordinatePoint[key].offsetX};top:${coordinatePoint[key].offsetY};transform:scale(${this.zoom}) translate(0, -50px);animation-delay:${r(-12,-1)}s`)
|
||||||
group.attr('class', 'constellation')
|
group.attr('class', 'constellation')
|
||||||
const polyline = group.polyline(coordinatePoint[key].point.map(item => [item.x, item.y])) // 先将所有点 用直线链接
|
const polyline = group.polyline(coordinatePoint[key].point.map(item => [item.x, item.y])) // 先将所有点 用直线链接
|
||||||
polyline.fill('none')
|
polyline.fill('none')
|
||||||
@@ -536,6 +536,8 @@ export default {
|
|||||||
}
|
}
|
||||||
.constellation{
|
.constellation{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
/*-webkit-animation: constellationAnimat var(--twinkle-duration) ease-in-out infinite;*/
|
||||||
|
/*animation: constellationAnimat var(--twinkle-duration) ease-in-out infinite;*/
|
||||||
}
|
}
|
||||||
:root {
|
:root {
|
||||||
--twinkle-duration: 4s;
|
--twinkle-duration: 4s;
|
||||||
@@ -584,6 +586,25 @@ export default {
|
|||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@-webkit-keyframes constellationAnimat {
|
||||||
|
25% {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes constellationAnimat {
|
||||||
|
25%{
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
/*50%{*/
|
||||||
|
/* opacity: 1;*/
|
||||||
|
/*}*/
|
||||||
|
/*75%{*/
|
||||||
|
/* opacity: 0.5;*/
|
||||||
|
/*}*/
|
||||||
|
/*100%{*/
|
||||||
|
/* opacity: 1;*/
|
||||||
|
/*}*/
|
||||||
|
}
|
||||||
.star {
|
.star {
|
||||||
fill: white;
|
fill: white;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user