This commit is contained in:
sunmeng 2025-05-09 14:58:19 +08:00
parent 9495c40a9d
commit 153628ddb9

View File

@ -33,9 +33,13 @@
const startX = ref(0)
const startY = ref(0)
const isDragging = ref(false)
const tempX = ref()
const tempY = ref()
const tempFlag = ref(true)
const imgUrl = ref('https://assets.sx25.troyrc.com/sx25/images/events/XBDT.jpg'); // ref
const blocks = ref(
[
[
{
"areacode": "ksmj71jukqf7",
"areaname": "B2区",
@ -1942,27 +1946,14 @@
//
const handleTouchStart = (e) => {
tempFlag.value = true
console.log('handleTouchStart')
//
const x = e.touches[0].x;
const y = e.touches[0].y;
tempX.value = e.touches[0].x;
tempY.value = e.touches[0].y;
//
blocks.value.forEach((block) => {
if (isPointInQuadrilateral(x, y, block.polygon)) {
uni.showModal({
title: '提示',
content: block.hint,
showCancel: true, //
success: (res) => {
if (res.confirm) {
console.log('用户点击了“确定”按钮');
} else if (res.cancel) {
console.log('用户点击了“取消”按钮');
}
},
});
}
});
if (e.touches.length === 1) {
//
startX.value = e.touches[0].clientX - offsetX.value
@ -1981,6 +1972,7 @@
//
const handleTouchMove = (e) => {
console.log('11111');
tempFlag.value = false
if (e.touches.length === 1 && isDragging.value) {
// ...
offsetX.value = e.touches[0].clientX - startX.value;
@ -2007,6 +1999,25 @@
console.log('handleTouchEnd')
lastDistance.value = -1
isDragging.value = false
if(!tempFlag.value){
return
}
blocks.value.forEach((block) => {
if (isPointInQuadrilateral(tempX.value, tempY.value, block.polygon)) {
uni.showModal({
title: '提示',
content: block.hint,
showCancel: true, //
success: (res) => {
if (res.confirm) {
console.log('用户点击了“确定”按钮');
} else if (res.cancel) {
console.log('用户点击了“取消”按钮');
}
},
});
}
});
}
//