修改点时,去掉弹窗事件

tykong-cidian
dongjiajun 2024-07-08 09:22:57 +08:00
parent 43e6b9ac2a
commit 716dec950b
2 changed files with 13 additions and 17 deletions

View File

@ -138,7 +138,7 @@
</div> </div>
<canvas v-show="checkRealityWait" id="scaleBar"></canvas> <canvas v-show="checkRealityWait" id="scaleBar"></canvas>
<div class="update-btns" v-show="updatePointVisible"> <div class="update-btns" v-show="updatePointVisible">
<div><el-button type="primary" @click="selectPoint"></el-button></div> <div><el-button type="primary" @click="selectPoint" :disabled="isSelectPointDisabled">选取点</el-button></div>
<div><el-button type="primary" @click="savePoint"></el-button></div> <div><el-button type="primary" @click="savePoint"></el-button></div>
</div> </div>
</div> </div>
@ -261,11 +261,15 @@ export default {
updatePointVisible:false, updatePointVisible:false,
currentSelectPoint: null, // currentSelectPoint: null, //
updatedPoint:null, // updatedPoint:null, //
isClickEventOpen:true,
isSelectPointDisabled:false,
}; };
}, },
mounted() { mounted() {
cu.initCesium("cesiumView"); cu.initCesium("cesiumView");
cu.handleClick(); // if(this.isClickEventOpen){
// cu.handleClick();
// }
cu.addlayer(this.geoWorkSpace, this.geoLayerName); cu.addlayer(this.geoWorkSpace, this.geoLayerName);
let gp = this.geoLayerPos; let gp = this.geoLayerPos;
cu.flyToLayerRect(gp[0], gp[1], gp[2], gp[3]); cu.flyToLayerRect(gp[0], gp[1], gp[2], gp[3]);
@ -435,7 +439,9 @@ export default {
} }
}, },
pickValue() { pickValue() {
cu.handleClick(); if(this.isClickEventOpen){
cu.handleClick();
}
}, },
changeSampleFun(sfVal) { changeSampleFun(sfVal) {
// //
@ -606,7 +612,7 @@ export default {
editSelected(index, simpleData) { editSelected(index, simpleData) {
// //
this.updatePointVisible = true; this.updatePointVisible = true;
this.isClickEventOpen = false;//
cu.removePoint() cu.removePoint()
// //
if (simpleData.length !== 0) { if (simpleData.length !== 0) {
@ -620,13 +626,6 @@ export default {
} }
// //
this.currentSelectPoint = simpleData[index]; this.currentSelectPoint = simpleData[index];
// this.$confirm(``, "", {
// confirmButtonText: "",
// cancelButtonText: "",
// type: "warning",
// }).then(async () => {
// simpleData.splice(index, 1);
// });
}, },
// //
selectPoint(){ selectPoint(){
@ -638,6 +637,7 @@ export default {
lat: point[1], lat: point[1],
} }
}) })
this.isSelectPointDisabled = true;
}, },
// //
savePoint(){ savePoint(){
@ -657,6 +657,8 @@ export default {
this.updatePointVisible = false; this.updatePointVisible = false;
// //
cu.destroyClickToAddPoint() cu.destroyClickToAddPoint()
this.isClickEventOpen = true;
this.isSelectPointDisabled = false;
} }
}, },
computed: { computed: {

View File

@ -181,14 +181,11 @@ class CesiumUtils {
if (this.handler) { if (this.handler) {
this.handler.destroy(); this.handler.destroy();
} }
// return new Promise((resolve, reject) => {
var scene = this.viewer.scene; var scene = this.viewer.scene;
this.handler = new Cesium.ScreenSpaceEventHandler(scene.canvas); this.handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
const that = this; const that = this;
this.handler.setInputAction(function (movement) { this.handler.setInputAction(function (movement) {
// 清除历史单击点 // 清除历史单击点
// handler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK);
// movement.position 像素的x、y坐标
var cartesian = that.viewer.camera.pickEllipsoid( var cartesian = that.viewer.camera.pickEllipsoid(
movement.position, movement.position,
scene.globe.ellipsoid scene.globe.ellipsoid
@ -215,14 +212,11 @@ class CesiumUtils {
callback(positions); callback(positions);
} }
}, Cesium.ScreenSpaceEventType.LEFT_CLICK); }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
// });
} }
//销毁监听 //销毁监听
static destroyClickToAddPoint(){ static destroyClickToAddPoint(){
this.handler.destroy(); this.handler.destroy();
} }
//鼠标点击 //鼠标点击
static handleClick() { static handleClick() {
var scene = this.viewer.scene; var scene = this.viewer.scene;