|
@@ -24,6 +24,7 @@
|
24
|
24
|
<img class="map-border border-left" :src="borders[2]" alt="" :style="borderLRStyle">
|
25
|
25
|
<img class="map-border border-right" :src="borders[3]" alt="" :style="borderLRStyle">
|
26
|
26
|
<ZoomOut class="map-zoom-gesture" v-if="showZoomGesture" />
|
|
27
|
+ <div class="slide-tip">点击此处 上下滑动</div>
|
27
|
28
|
</div>
|
28
|
29
|
</template>
|
29
|
30
|
|
|
@@ -80,7 +81,6 @@
|
80
|
81
|
});
|
81
|
82
|
|
82
|
83
|
document.body.addEventListener('click', () => {
|
83
|
|
- showZoomGesture.value = false;
|
84
|
84
|
if (playing.value) {
|
85
|
85
|
audioRef.value.toggle();
|
86
|
86
|
}
|
|
@@ -112,7 +112,6 @@
|
112
|
112
|
}
|
113
|
113
|
|
114
|
114
|
const onMapClick = (e) => {
|
115
|
|
- showZoomGesture.value = false
|
116
|
115
|
const { lnglat } = e;
|
117
|
116
|
|
118
|
117
|
// 计算点击位置, 与各景点距离
|
|
@@ -148,6 +147,7 @@
|
148
|
147
|
center,
|
149
|
148
|
zooms,
|
150
|
149
|
zoom: zooms[0],
|
|
150
|
+ // dragEnable: false, // 禁止拖动
|
151
|
151
|
});
|
152
|
152
|
|
153
|
153
|
// 获取左上角经纬度
|
|
@@ -200,27 +200,31 @@
|
200
|
200
|
console.log('--------->', e)
|
201
|
201
|
onMapClick(e)
|
202
|
202
|
})
|
|
203
|
+
|
|
204
|
+ map.on('zoomchange', (e) => {
|
|
205
|
+ console.log('----zoomchange----->', e)
|
|
206
|
+ })
|
203
|
207
|
}
|
204
|
208
|
|
205
|
|
- // onMounted(() => {
|
206
|
|
- // // 当前地图可见的时候展示放大手势
|
207
|
|
- // // 2秒后自动关闭
|
208
|
|
- // const observer = new IntersectionObserver((entries) => {
|
209
|
|
- // if (entries && entries[0]) {
|
210
|
|
- // if (entries[0].intersectionRatio >= 0.6) {
|
211
|
|
- // showZoomGesture.value = true;
|
212
|
|
-
|
213
|
|
- // const t = setTimeout(() => {
|
214
|
|
- // clearTimeout(t);
|
215
|
|
- // showZoomGesture.value = false;
|
216
|
|
- // observer.disconnect();
|
217
|
|
- // }, 2000);
|
218
|
|
- // }
|
219
|
|
- // }
|
220
|
|
- // }, { threshold: [0.6] });
|
221
|
|
-
|
222
|
|
- // observer.observe(elRef.value);
|
223
|
|
- // })
|
|
209
|
+ onMounted(() => {
|
|
210
|
+ // 当前地图可见的时候展示放大手势
|
|
211
|
+ // 2秒后自动关闭
|
|
212
|
+ const observer = new IntersectionObserver((entries) => {
|
|
213
|
+ if (entries && entries[0]) {
|
|
214
|
+ if (entries[0].intersectionRatio >= 0.6) {
|
|
215
|
+ showZoomGesture.value = true;
|
|
216
|
+
|
|
217
|
+ const t = setTimeout(() => {
|
|
218
|
+ clearTimeout(t);
|
|
219
|
+ showZoomGesture.value = false;
|
|
220
|
+ observer.disconnect();
|
|
221
|
+ }, 2000);
|
|
222
|
+ }
|
|
223
|
+ }
|
|
224
|
+ }, { threshold: [0.6] });
|
|
225
|
+
|
|
226
|
+ observer.observe(elRef.value);
|
|
227
|
+ })
|
224
|
228
|
|
225
|
229
|
</script>
|
226
|
230
|
|
|
@@ -337,6 +341,20 @@
|
337
|
341
|
left: calc(50% - 25px);
|
338
|
342
|
top: calc(50% - 50px);
|
339
|
343
|
}
|
|
344
|
+
|
|
345
|
+ .slide-tip {
|
|
346
|
+ left: auto;
|
|
347
|
+ top: 160px;
|
|
348
|
+ right: 2px;
|
|
349
|
+ width: 1.6em;
|
|
350
|
+ height: 300px;
|
|
351
|
+ color: #576147;
|
|
352
|
+ letter-spacing: 2px;
|
|
353
|
+ font-weight: bold;
|
|
354
|
+ writing-mode: vertical-lr;
|
|
355
|
+ z-index: 200;
|
|
356
|
+ cursor: pointer;
|
|
357
|
+ }
|
340
|
358
|
}
|
341
|
359
|
|
342
|
360
|
</style>
|