|
@@ -23,16 +23,18 @@
|
23
|
23
|
<img class="map-border border-bottom" :src="borders[1]" alt="" @load="onBorderBottomLoad">
|
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
|
+ <ZoomOut class="map-zoom-gesture" v-if="showZoomGesture" />
|
26
|
27
|
</div>
|
27
|
28
|
</template>
|
28
|
29
|
|
29
|
30
|
<script setup>
|
30
|
|
- import { computed, ref, watch } from "vue";
|
31
|
|
- import AudioVue from './Audio.vue';
|
|
31
|
+ import { computed, onMounted, ref, watch } from "vue";
|
32
|
32
|
import { useModel } from "@zjxpcyc/vue-tiny-store";
|
33
|
33
|
import { newMarker } from '@/utils/amap';
|
34
|
34
|
import { resources, borders } from '@/utils/resources';
|
35
|
|
- import wxsdk from "../utils/wx";
|
|
35
|
+ import wxsdk from "@/utils/wx";
|
|
36
|
+ import AudioVue from './Audio.vue';
|
|
37
|
+ import ZoomOut from './ZoomOut.vue';
|
36
|
38
|
|
37
|
39
|
const props = defineProps({
|
38
|
40
|
image: {
|
|
@@ -57,6 +59,7 @@
|
57
|
59
|
const playing = ref(false);
|
58
|
60
|
const borderTopSize = ref();
|
59
|
61
|
const borderBottomSize = ref();
|
|
62
|
+ const showZoomGesture = ref(true);
|
60
|
63
|
|
61
|
64
|
const isReady = computed(() => imgRef.value && mapIsReady.value);
|
62
|
65
|
const borderLRStyle = computed(() => {
|
|
@@ -77,6 +80,7 @@
|
77
|
80
|
});
|
78
|
81
|
|
79
|
82
|
document.body.addEventListener('click', () => {
|
|
83
|
+ showZoomGesture.value = false;
|
80
|
84
|
if (playing.value) {
|
81
|
85
|
audioRef.value.toggle();
|
82
|
86
|
}
|
|
@@ -108,6 +112,7 @@
|
108
|
112
|
}
|
109
|
113
|
|
110
|
114
|
const onMapClick = (e) => {
|
|
115
|
+ showZoomGesture.value = false
|
111
|
116
|
const { lnglat } = e;
|
112
|
117
|
|
113
|
118
|
// 计算点击位置, 与各景点距离
|
|
@@ -197,6 +202,26 @@
|
197
|
202
|
})
|
198
|
203
|
}
|
199
|
204
|
|
|
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
|
+ // })
|
|
224
|
+
|
200
|
225
|
</script>
|
201
|
226
|
|
202
|
227
|
<style lang="less" scoped>
|
|
@@ -305,6 +330,13 @@
|
305
|
330
|
.border-right {
|
306
|
331
|
right: 0;
|
307
|
332
|
}
|
|
333
|
+
|
|
334
|
+ .map-zoom-gesture {
|
|
335
|
+ width: 100px;
|
|
336
|
+ height: 100px;
|
|
337
|
+ left: calc(50% - 25px);
|
|
338
|
+ top: calc(50% - 50px);
|
|
339
|
+ }
|
308
|
340
|
}
|
309
|
341
|
|
310
|
342
|
</style>
|