选位问题修复
This commit is contained in:
parent
1b8b891531
commit
8315e35852
@ -78,9 +78,10 @@ export default {
|
||||
|
||||
methods: {
|
||||
handleCanvasClick(e) {
|
||||
if (!this.containerRect) return;
|
||||
// 如果是移动操作则忽略点击
|
||||
if (this.isMoving) return;
|
||||
if (this.isMoving) {
|
||||
this.isMoving = false; // 重置移动状态
|
||||
return;
|
||||
}
|
||||
// 获取dpr
|
||||
const dpr = this.$refs.canvasRef.dpr || 1;
|
||||
|
||||
@ -180,9 +181,12 @@ export default {
|
||||
|
||||
initGestureHandler() {
|
||||
try {
|
||||
this.gestureHandler = new GestureHandler(this, this.transformMatrix, {
|
||||
container: this.containerRect
|
||||
});
|
||||
// this.gestureHandler = new GestureHandler(this, this.transformMatrix, {
|
||||
// container: this.containerRect
|
||||
// });
|
||||
this.gestureHandler = new GestureHandler(this, this.transformMatrix, {
|
||||
container: this.containerRect
|
||||
});
|
||||
// console.log( 'initGestureHandler', this.gestureHandler )
|
||||
} catch (e) {
|
||||
console.error('手势处理器初始化失败:', e);
|
||||
@ -262,24 +266,30 @@ export default {
|
||||
// 更新触点数量
|
||||
this.touchPoints = event.touches.length;
|
||||
// 增加移动状态检测
|
||||
if (event.type === 'touchstart') {
|
||||
this.lastTouchTime = Date.now();
|
||||
this.touchStartPoint = {
|
||||
x: event.touches[0].clientX,
|
||||
y: event.touches[0].clientY
|
||||
};
|
||||
this.isMoving = false; // 重置移动状态
|
||||
}
|
||||
else if (event.type === 'touchmove') {
|
||||
// 检测移动距离是否超过阈值
|
||||
if (this.touchStartPoint) {
|
||||
const dx = Math.abs(event.touches[0].clientX - this.touchStartPoint.x);
|
||||
const dy = Math.abs(event.touches[0].clientY - this.touchStartPoint.y);
|
||||
if (dx > 5 || dy > 5) {
|
||||
this.isMoving = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (event.type === 'touchstart') {
|
||||
this.isMoving = false; // 重置移动状态
|
||||
} else if (event.type === 'touchmove') {
|
||||
this.isMoving = true; // 标记为移动操作
|
||||
}
|
||||
|
||||
// if (event.type === 'touchstart') {
|
||||
// this.lastTouchTime = Date.now();
|
||||
// this.touchStartPoint = {
|
||||
// x: event.touches[0].clientX,
|
||||
// y: event.touches[0].clientY
|
||||
// };
|
||||
// this.isMoving = false; // 重置移动状态
|
||||
// }
|
||||
// else if (event.type === 'touchmove') {
|
||||
// // 检测移动距离是否超过阈值
|
||||
// if (this.touchStartPoint) {
|
||||
// const dx = Math.abs(event.touches[0].clientX - this.touchStartPoint.x);
|
||||
// const dy = Math.abs(event.touches[0].clientY - this.touchStartPoint.y);
|
||||
// if (dx > 5 || dy > 5) {
|
||||
// this.isMoving = true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// 仅在触摸开始时重置状态
|
||||
// if (event.type === 'touchstart') {
|
||||
@ -665,14 +675,18 @@ export default {
|
||||
y: data.yCoords[index] * seatSize
|
||||
};
|
||||
});
|
||||
// 重置变换矩阵
|
||||
this.transformMatrix = new TransformMatrix();
|
||||
|
||||
|
||||
// 重新初始化手势处理器
|
||||
await this.getContainerPosition();
|
||||
this.initGestureHandler();
|
||||
// 自动居中显示座位区域
|
||||
// 自动居中显示座位区域
|
||||
this.$nextTick(() => {
|
||||
if (!this.gestureHandler) {
|
||||
this.initGestureHandler();
|
||||
}
|
||||
// if (!this.gestureHandler) {
|
||||
// this.initGestureHandler();
|
||||
// }
|
||||
if (this.seatPositions.length > 0) {
|
||||
// 计算座位区域边界
|
||||
const xs = this.seatPositions.map(s => s.x);
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"gesture-canvas-page.js","sources":["pages/index/gesture-canvas-page.vue?type=page"],"sourcesContent":["import MiniProgramPage from '/Users/sunmeng/Desktop/wx/canvas/pages/index/gesture-canvas-page.vue'\nwx.createPage(MiniProgramPage)"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,GAAG,WAAW,eAAe;"}
|
||||
{"version":3,"file":"gesture-canvas-page.js","sources":["pages/index/gesture-canvas-page.vue?type=page"],"sourcesContent":["import MiniProgramPage from '/Users/sunmeng/Desktop/wx/canvas/pages/index/gesture-canvas-page.vue'\nwx.createPage(MiniProgramPage)"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,GAAG,WAAW,eAAe;"}
|
@ -6882,7 +6882,7 @@ function initOnError() {
|
||||
function initRuntimeSocketService() {
|
||||
const hosts = "127.0.0.1,172.10.0.127";
|
||||
const port = "8090";
|
||||
const id = "mp-weixin_Mc-x4m";
|
||||
const id = "mp-weixin_pbUakk";
|
||||
const lazy = typeof swan !== "undefined";
|
||||
let restoreError = lazy ? () => {
|
||||
} : initOnError();
|
||||
|
@ -39,10 +39,10 @@ const _sfc_main = {
|
||||
},
|
||||
methods: {
|
||||
handleCanvasClick(e) {
|
||||
if (!this.containerRect)
|
||||
return;
|
||||
if (this.isMoving)
|
||||
if (this.isMoving) {
|
||||
this.isMoving = false;
|
||||
return;
|
||||
}
|
||||
const dpr = this.$refs.canvasRef.dpr || 1;
|
||||
const x = (e.detail.x - this.containerRect.left) * dpr;
|
||||
const y = (e.detail.y - this.containerRect.top) * dpr;
|
||||
@ -65,7 +65,7 @@ const _sfc_main = {
|
||||
} else if (this.currentView === "seat") {
|
||||
const hitSeat = this.$refs.canvasRef.checkSeatHit(x, y);
|
||||
if (hitSeat) {
|
||||
common_vendor.index.__f__("log", "at pages/index/gesture-canvas-page.vue:112", "选中座位:", hitSeat);
|
||||
common_vendor.index.__f__("log", "at pages/index/gesture-canvas-page.vue:113", "选中座位:", hitSeat);
|
||||
this.toggleSeatSelection(hitSeat);
|
||||
}
|
||||
}
|
||||
@ -112,7 +112,7 @@ const _sfc_main = {
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
common_vendor.index.__f__("error", "at pages/index/gesture-canvas-page.vue:172", "获取容器位置失败:", e);
|
||||
common_vendor.index.__f__("error", "at pages/index/gesture-canvas-page.vue:173", "获取容器位置失败:", e);
|
||||
}
|
||||
await new Promise((r) => setTimeout(r, 100));
|
||||
retryCount++;
|
||||
@ -124,7 +124,7 @@ const _sfc_main = {
|
||||
container: this.containerRect
|
||||
});
|
||||
} catch (e) {
|
||||
common_vendor.index.__f__("error", "at pages/index/gesture-canvas-page.vue:188", "手势处理器初始化失败:", e);
|
||||
common_vendor.index.__f__("error", "at pages/index/gesture-canvas-page.vue:192", "手势处理器初始化失败:", e);
|
||||
this.gestureHandler = {
|
||||
catchEvent: this.createGestureFallback(),
|
||||
setScale: (scale) => {
|
||||
@ -182,20 +182,9 @@ const _sfc_main = {
|
||||
var _a;
|
||||
this.touchPoints = event.touches.length;
|
||||
if (event.type === "touchstart") {
|
||||
this.lastTouchTime = Date.now();
|
||||
this.touchStartPoint = {
|
||||
x: event.touches[0].clientX,
|
||||
y: event.touches[0].clientY
|
||||
};
|
||||
this.isMoving = false;
|
||||
} else if (event.type === "touchmove") {
|
||||
if (this.touchStartPoint) {
|
||||
const dx = Math.abs(event.touches[0].clientX - this.touchStartPoint.x);
|
||||
const dy = Math.abs(event.touches[0].clientY - this.touchStartPoint.y);
|
||||
if (dx > 5 || dy > 5) {
|
||||
this.isMoving = true;
|
||||
}
|
||||
}
|
||||
this.isMoving = true;
|
||||
}
|
||||
(_a = this.gestureHandler) == null ? void 0 : _a.catchEvent(event);
|
||||
if (event.type === "touchend" || event.type === "touchcancel") {
|
||||
@ -543,7 +532,7 @@ const _sfc_main = {
|
||||
};
|
||||
this.seatAreas = response.data;
|
||||
} catch (e) {
|
||||
common_vendor.index.__f__("error", "at pages/index/gesture-canvas-page.vue:647", "加载区域数据失败:", e);
|
||||
common_vendor.index.__f__("error", "at pages/index/gesture-canvas-page.vue:657", "加载区域数据失败:", e);
|
||||
}
|
||||
},
|
||||
async loadSeatData(areaCode) {
|
||||
@ -563,10 +552,9 @@ const _sfc_main = {
|
||||
};
|
||||
});
|
||||
this.transformMatrix = new pages_index_transformMatrix.TransformMatrix();
|
||||
await this.getContainerPosition();
|
||||
this.initGestureHandler();
|
||||
this.$nextTick(() => {
|
||||
if (!this.gestureHandler) {
|
||||
this.initGestureHandler();
|
||||
}
|
||||
if (this.seatPositions.length > 0) {
|
||||
const xs = this.seatPositions.map((s) => s.x);
|
||||
const ys = this.seatPositions.map((s) => s.y);
|
||||
@ -582,7 +570,7 @@ const _sfc_main = {
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
common_vendor.index.__f__("error", "at pages/index/gesture-canvas-page.vue:705", "加载座位数据失败:", e);
|
||||
common_vendor.index.__f__("error", "at pages/index/gesture-canvas-page.vue:719", "加载座位数据失败:", e);
|
||||
common_vendor.index.showToast({ title: "加载座位失败", icon: "none" });
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user