建图
This commit is contained in:
@@ -68,6 +68,7 @@ export default {
|
||||
updateThrottle: 50, // 数据更新节流间隔(ms)
|
||||
lastUpdateTime: 0,
|
||||
// resizeHandler: null // 存储resize事件处理函数
|
||||
hasYellowDot: false,
|
||||
yellowDotSprite: null,
|
||||
yellowDotInitialPos: null
|
||||
}
|
||||
@@ -221,6 +222,8 @@ export default {
|
||||
});
|
||||
},
|
||||
createYellowDot(initialX, initialY) {
|
||||
if (this.hasYellowDot) return
|
||||
this.hasYellowDot = true
|
||||
// 存储初始位置(后续不更新)
|
||||
this.yellowDotInitialPos = { x: initialX, y: initialY };
|
||||
|
||||
@@ -584,6 +587,7 @@ export default {
|
||||
if (this.reconnectTimer) clearTimeout(this.reconnectTimer)
|
||||
const pointData = JSON.parse(event.data)
|
||||
this.updatePointCloud(pointData.globalData)
|
||||
this.createYellowDot(this.carPosition.x, this.carPosition.y)
|
||||
} catch (error) {
|
||||
console.error('解析点云数据失败:', error)
|
||||
}
|
||||
@@ -612,7 +616,6 @@ export default {
|
||||
},
|
||||
init() {
|
||||
this.initWebSocket()
|
||||
this.createYellowDot(this.carPosition.x, this.carPosition.y)
|
||||
// this.isLoading = false;
|
||||
// const pointData = points.data
|
||||
// this.updatePointCloud(pointData);
|
||||
|
||||
@@ -248,9 +248,11 @@ export default {
|
||||
if (res && res.code === 200) {
|
||||
this.message = this.$t('carbuildingmap')
|
||||
this.error = false
|
||||
this.$nextTick(() => {
|
||||
this.$refs.glMap.init()
|
||||
})
|
||||
setTimeout(() => {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.glMap.init()
|
||||
})
|
||||
}, 2000)
|
||||
}
|
||||
this.loading.close()
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user