|
@@ -28,7 +28,7 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- checkedDot:false,
|
|
|
+ checkedDot: false,
|
|
|
Tmap: null,
|
|
|
option: {
|
|
|
type: '',
|
|
@@ -123,7 +123,7 @@
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
+
|
|
|
mounted() {
|
|
|
|
|
|
},
|
|
@@ -140,7 +140,7 @@
|
|
|
// }
|
|
|
// console.log("this.MyLngLat = " , this.MyLngLat)
|
|
|
// this.setMyIcon()
|
|
|
-
|
|
|
+
|
|
|
EventBus.$emit('TianDiTuSearch', (res) => {
|
|
|
const { longitude, latitude } = res;
|
|
|
this.SelectedDot({ longitude, latitude })
|
|
@@ -177,19 +177,19 @@
|
|
|
try {
|
|
|
console.log('------------------')
|
|
|
// 地图移动,判断是否缩放/移动地图,还是通过点位定位
|
|
|
- if(!this.checkedDot){
|
|
|
+ if (!this.checkedDot) {
|
|
|
// 自然缩放移动,刷新接口
|
|
|
const v = e.target.getCenter()
|
|
|
const Lng = v.getLng();
|
|
|
const Lat = v.getLat();
|
|
|
this.$emit("moveMap", { Lng, Lat })
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
// 点位移动,做处理
|
|
|
this.$nextTick(() => {
|
|
|
this.checkedDot = false;
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
} catch (error) {
|
|
|
//TODO handle the exception
|
|
|
}
|
|
@@ -197,10 +197,10 @@
|
|
|
|
|
|
// 点击地图标注的点位
|
|
|
clickMapSite({ type, target, lnglat, containerPoint }) {
|
|
|
+ console.log('clickMapSite === ', 1)
|
|
|
const Lng = lnglat.getLng();
|
|
|
const Lat = lnglat.getLat();
|
|
|
this.$emit('handleMapSite', { Lng, Lat })
|
|
|
-
|
|
|
},
|
|
|
// 天地图缩放事件
|
|
|
handleZoomEvent(event) {
|
|
@@ -233,18 +233,19 @@
|
|
|
},
|
|
|
setViewport() {
|
|
|
try {
|
|
|
- console.log('window.devicePixelRatio = ', window.devicePixelRatio)
|
|
|
- console.log('window.getResolution 1 = 1 ', Tmap , window.screen.width * window.devicePixelRatio)
|
|
|
- const w = window.screen.width * window.devicePixelRatio
|
|
|
+ console.log('window.devicePixelRatio = ', window.devicePixelRatio)
|
|
|
+ console.log('window.getResolution 1 = 1 ', Tmap, window.screen.width * window.devicePixelRatio)
|
|
|
+ const w = window.screen.width * window.devicePixelRatio
|
|
|
const meta = document.createElement('meta')
|
|
|
meta.name = 'viewport'
|
|
|
- meta.content = `width=device-width,initial-scale=1.0, maximum-scale=1.0,minimum-scale=1.0, user-scalable=no`
|
|
|
+ meta.content =
|
|
|
+ `width=device-width,initial-scale=1.0, maximum-scale=1.0,minimum-scale=1.0, user-scalable=no`
|
|
|
// meta.content = `initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no`
|
|
|
// meta.media = `(device-height: 568px)`
|
|
|
-
|
|
|
+
|
|
|
document.head.appendChild(meta)
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
} catch (err) {
|
|
|
console.log('---------- ', err)
|
|
|
}
|
|
@@ -314,14 +315,14 @@
|
|
|
this.setIcon(lng, lat, true)
|
|
|
Tmap.centerAndZoom(new T.LngLat(lng, lat), 15);
|
|
|
},
|
|
|
- setIcon(lng, lat, isClear, iconU, info) {
|
|
|
+ setIcon(lng, lat, isClear, iconU, info, max = false) {
|
|
|
if (isClear) {
|
|
|
this.clearIcon()
|
|
|
}
|
|
|
const icon = new T.Icon({
|
|
|
iconUrl: iconU || this.options.png,
|
|
|
- iconSize: new T.Point(45, 45),
|
|
|
- iconAnchor: new T.Point(15, 30)
|
|
|
+ iconSize: max ? new T.Point(60, 60) : new T.Point(45, 45),
|
|
|
+ iconAnchor: new T.Point(15, 45)
|
|
|
});
|
|
|
const marker = new T.Marker(new T.LngLat(lng, lat), {
|
|
|
icon
|
|
@@ -391,10 +392,13 @@
|
|
|
console.log("天地图获取定位 = error ", error)
|
|
|
}
|
|
|
},
|
|
|
- SelectedDot(res , dot = false) {
|
|
|
+ SelectedDot(res, dot = false, level = 16) {
|
|
|
this.checkedDot = dot
|
|
|
const { longitude, latitude } = res;
|
|
|
- Tmap.panTo(new T.LngLat(longitude, latitude), 16); // 移动到选中的点位
|
|
|
+ Tmap.panTo(new T.LngLat(longitude, latitude), level); // 移动到选中的点位
|
|
|
+ },
|
|
|
+ setMaxIcon() {
|
|
|
+
|
|
|
},
|
|
|
setMyIcon() {
|
|
|
const { lng, lat } = this.MyLngLat || {}
|
|
@@ -408,7 +412,7 @@
|
|
|
icon
|
|
|
});
|
|
|
|
|
|
- Tmap.addOverLay(marker);
|
|
|
+ // Tmap.addOverLay(marker);
|
|
|
try {
|
|
|
marker.removeEventListener("click", () => {});
|
|
|
} catch (error) {}
|