修改鼠标静止隐藏移动显示逻辑

This commit is contained in:
zyy 2019-12-30 14:06:42 +08:00
parent ce44ec4429
commit 4a06c92ea1
3 changed files with 29 additions and 14 deletions

View File

@ -255,7 +255,8 @@ const map = {
mapDataLoadedCount: 0, // 地图数据加载完成标识
trainDetails: null, // 地图'列车详情'显示
deleteCount: 0, // 绘图快捷删除标识
updateCount: 0 // 绘图快捷修改标识
updateCount: 0, // 绘图快捷修改标识
mousemove: 0 // 实训战场图移动标识
},
getters: {
@ -600,7 +601,10 @@ const map = {
},
setUpdateCount: (state) => {
state.updateCount++;
}
},
setMousemove: (state) => {
state.mousemove++;
},
},
actions: {
@ -718,7 +722,11 @@ const map = {
setUpdateCount: ({ commit }) => {
commit('setUpdateCount');
}
},
setMousemove: ({ commit }) => {
commit('setMousemove');
},
}
};

View File

@ -1,5 +1,5 @@
<template>
<div class="main" :style="{width: canvasWidth+'px'}" @mousemove="mousemove">
<div class="main" :style="{width: canvasWidth+'px'}">
<div v-show="panelShow" :panelShow="panelShow">
<transition name="el-zoom-in-bottom">
<map-system-draft ref="mapCanvas" @back="back" />
@ -209,6 +209,9 @@ export default {
}
},
'$store.state.map.mousemove': function (val) {
this.mousemove();
},
'$store.state.socket.permissionOver': function () {
this.$alert('用户权限已被收回', '提示', {
confirmButtonText: '确定',
@ -286,20 +289,23 @@ export default {
} else {
this.mouseNumTime += 1;
}
if (this.mapBox) {
if (this.mouseNumTime >= 15) {
for (let i = 0; i < this.mapBox.length; i++) {
this.mapBox[i].style.cursor = 'none';
}
if (this.mapBoxP) {
if (this.mouseNumTime >= 8) {
this.mapBoxP.style.cursor = 'none';
// for (let i = 0; i < this.mapBox.length; i++) {
// console.log(this.mapBox);
// this.mapBox[i].style.cursor = 'none';
// }
} else {
for (let i = 0; i < this.mapBox.length; i++) {
this.mapBox[i].style.cursor = '';
}
this.mapBoxP.style.cursor = '';
// for (let i = 0; i < this.mapBox.length; i++) {
// this.mapBox[i].style.cursor = '';
// }
}
}
}, 1000);
},
mousemove(e) {
mousemove() {
this.mouseNum = 1;
},
setPosition() {

View File

@ -1,6 +1,6 @@
<template>
<div class="jlmap-canvas" :style="{ width: width+'px', height: height+'px' }" @mousemove.stop="mousemove">
<div :id="canvasId" style="background: #000;" />
<div :id="canvasId" style="background: #000;" class="display_canvas" />
<progress-bar ref="progressBar" />
<zoom-box v-if="!isScreen" :scale-rate="dataZoom.scaleRate" @setShrink="setShrink" @setMagnify="setMagnify" />
<div v-if="show" class="zoom-view" :style="{ width: width +'px'}">
@ -305,6 +305,7 @@ export default {
x: e.offsetX + Number(this.dataZoom.offsetX),
y: e.offsetY + Number(this.dataZoom.offsetY)
};
this.$store.dispatch('map/setMousemove');
}
}
};