Skip to content

Commit 0fd5961

Browse files
committed
fix(map): 异常重置中心点
1 parent 76d473f commit 0fd5961

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jx3box/jx3box-map",
3-
"version": "1.1.9",
3+
"version": "1.1.10",
44
"description": "JX3BOX Game Map",
55
"main": "index.js",
66
"files": [

src/components/Map.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,8 @@ export default {
276276
this.initInnerOffset(this.focusPoint);
277277
});
278278
},
279-
centerPoint() {
279+
centerPoint(newVal, oldVal) {
280+
if (this.isSamePoint(newVal, oldVal)) return;
280281
this.$nextTick(() => {
281282
this.initInnerOffset(this.focusPoint);
282283
});
@@ -347,6 +348,11 @@ export default {
347348
bottom: bottom + "px",
348349
};
349350
},
351+
isSamePoint(a, b) {
352+
if (a === b) return true;
353+
if (!a || !b) return false;
354+
return a.x === b.x && a.y === b.y && a.z === b.z;
355+
},
350356
isPointsInRect(rect) {
351357
if (!this.datas.length) return false;
352358
let points = this.datas.map((p) => {

0 commit comments

Comments
 (0)