| | |
| | | this.map.infoWindow.hide(); |
| | | } |
| | | }, |
| | | |
| | | // zoomNum: this.map.getZoom(), |
| | | indexs: null, |
| | | onceTime: 300,//防抖定时 |
| | | onceTimeMethod: null,//防抖判断属性 |
| | | onClick: function (evt) { //标志以及聚合表示点击事件 |
| | | var eour = evt.graphic.attributes.clusterCount; |
| | | var mySelf = this; |
| | | if (eour == undefined) { |
| | | var dataO = evt; |
| | | var aa = evt.graphic.screenX; |
| | |
| | | // console.log(dataO); |
| | | // console.log(aa - bb); |
| | | |
| | | var fCard = (posi) => { |
| | | var fCard = (posi, ind, olds) => { |
| | | var that = this, |
| | | url = './popup/html/FlareClusterLayer_v3.html', |
| | | clickD = null, |
| | | clickG = null, |
| | | downs = null, |
| | | moves = null, |
| | | ups = null; |
| | |
| | | that.layuiLayer.config({ |
| | | extend: 'myskin/FlareClusterLayer.css' |
| | | }); |
| | | // layer.alert('layer 新皮肤'); |
| | | that.layuiLayer.close(that.layuiLayer.index); |
| | | // layer.alert('layer 新皮肤'); |
| | | that.layuiLayer.open({ |
| | | title: '', |
| | | type: 2, |
| | | shadeClose: false, |
| | | shade: false, |
| | | skin: 'demo-class', |
| | | id: 'onelyOne', |
| | | // id: 'onelyOne', |
| | | maxmin: false, //开启最大化最小化按钮 |
| | | area: ['200px', '75px'], |
| | | // area: 'auto', |
| | |
| | | content: [url, 'no'], |
| | | resize: false, |
| | | scrollbar: false, |
| | | tipsMore: true, //允许多个tipe |
| | | // tipsMore: true, //允许多个tipe |
| | | // content: num, |
| | | success: function (layero, index) {//成功后添加全局点击关闭 |
| | | $("#layui-layer-iframe" + index).contents().find("#input1").val(JSON.stringify(evt.graphic.attributes)); |
| | | // console.log(layero, index); |
| | | that.indexs = index; |
| | | |
| | | |
| | | var isclickD = true |
| | | , endx = null |
| | | , endy = null; |
| | | layero[0].style.position = 'absolute'; |
| | | downs = document.onmousedown = () => { |
| | | |
| | | downs = document.onmousedown = () => {//鼠标按下事件 |
| | | // console.log('down');//start |
| | | // downs = document.onmousedown = null; |
| | | var mx = window.event.clientX//鼠标初始位置 |
| | | , my = window.event.clientY |
| | | , cx = this.offset[1].replace("px","")//初始位置 |
| | | , cy = this.offset[0].replace("px",""); |
| | | moves = document.onmousemove = () => { |
| | | , cx = this.offset[1].replace("px", "")//初始位置 |
| | | , cy = this.offset[0].replace("px", ""); |
| | | if (endx != null && endy != null) { |
| | | cx = endx; |
| | | cy = endy; |
| | | } |
| | | moves = document.onmousemove = () => {//鼠标移动事件 |
| | | // console.log('move');//move |
| | | // console.log(this.offset) |
| | | var ux = window.event.clientX//记录实时位置 |
| | | , uy = window.event.clientY; |
| | | var endx = +cx + (ux - mx)// 初始位置+(鼠标初始位置-实时位置) |
| | | , endy = +cy + (uy - my); |
| | | endx = +cx + (ux - mx)// 初始位置+(鼠标初始位置-实时位置) |
| | | endy = +cy + (uy - my); |
| | | layero[0].style.left = endx + 'px'; |
| | | layero[0].style.top = endy + 'px'; |
| | | // console.log(+cx, +cy,'初始位置'); |
| | | // console.log(mx, my,'鼠标初始位置'); |
| | | // console.log(ux, uy,'记录实时位置'); |
| | | // console.log(ux, uy,'最后位置'); |
| | | |
| | | ups = document.onmouseup = () => { |
| | | isclickD = false; |
| | | ups = document.onmouseup = () => {//鼠标抬起事件 |
| | | // console.log('up');//end |
| | | downs = document.onmousedown = null; |
| | | // downs = document.onmousedown = null; |
| | | moves = document.onmousemove = null; |
| | | ups = document.onmouseup = null; |
| | | var timess = setTimeout(() => { |
| | | clearTimeout(timess); |
| | | timess = null; |
| | | isclickD = true; |
| | | }, 1); |
| | | } |
| | | } |
| | | } |
| | | |
| | | clickD = document.onclick = () => { |
| | | if (isclickD) { |
| | | parent[0].layer.close(index); |
| | | parent[0].layer.close(+index + 1); |
| | | // parent[0].layer.closeAll(); |
| | | // console.log(111111111111) |
| | | clickD = document.onclick = null; |
| | | } |
| | | } |
| | | |
| | | var mouseWheel = that.map.on("mouse-wheel", myMouseWheelHandler); |
| | | |
| | | function myMouseWheelHandler(event) { |
| | | // console.log("Mouse wheel value = " + event.value); |
| | | parent[0].layer.close(index); |
| | | parent[0].layer.close(+index + 1); |
| | | // parent[0].layer.closeAll(); |
| | | // console.log(111111111111) |
| | | clickD = document.onclick = null; |
| | | mouseWheel.remove(); |
| | | } |
| | | |
| | | }, |
| | |
| | | }) |
| | | }) |
| | | } |
| | | var offsetMy = [+evt.screenY - 300 + 'px', +evt.screenX - 172.5 + 'px']; |
| | | // var offsetMy = [+evt.graphic._shape.shape.y - 80 + 'px',+evt.graphic._shape.shape.x + 'px']; |
| | | fCard(offsetMy); |
| | | var begins = (xy) => { |
| | | var offsetMy = [xy.y + 'px', xy.x + 'px']; |
| | | if (mySelf.onceTimeMethod == null) {//防抖.限制时间内点击次数,否则会造成不能正确销毁前一个弹窗 |
| | | var offsetMy = [+evt.screenY - 300 + 'px', +evt.screenX - 172.5 + 'px']; |
| | | fCard(offsetMy); |
| | | } |
| | | mySelf.onceTimeMethod = setTimeout(() => { |
| | | mySelf.onceTimeMethod = null; |
| | | }, mySelf.onceTime); |
| | | } else { |
| | | }; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } else { |
| | | // var taxLotExtent = evt.graphic.geometry.getExtent(); |
| | | // this.map.setExtent(evt.graphic._extent) |
| | | this.map.setZoom(this.map.getZoom() + 1)//地图中心缩放 |
| | | // this.map.setZoom(18); |
| | | parent[0].layer.close(this.indexs) |
| | | parent[0].layer.close(+this.indexs + 1) |
| | | |
| | | // console.log('111:', this.map.zoomToFullExtent(), '222:', evt, evt.graphic._extent, 'zoom'); |
| | | } |
| | | // console.log(evt) |