From db929db466201b100a5af70add4a8f6b46bb8b5d Mon Sep 17 00:00:00 2001 From: 陈泽平 <qibolin02429@126.com> Date: 星期一, 17 五月 2021 10:30:50 +0800 Subject: [PATCH] 企业图层展示控制 --- src/components/LayerController/logic/Company.js | 38 +++++++++++++++++++++++++------------- 1 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/components/LayerController/logic/Company.js b/src/components/LayerController/logic/Company.js index 8c4bd07..962ec96 100644 --- a/src/components/LayerController/logic/Company.js +++ b/src/components/LayerController/logic/Company.js @@ -1,6 +1,7 @@ /** - * 鍥哄簾 + * 浼佷笟 */ + // 鍖哄垎涓嶅悓绫诲瀷 浣跨敤涓嶅悓img const companyImg = '/assets/images/map/company_refining.png' const companyOil = '/assets/images/map/company_oil.png' @@ -13,8 +14,8 @@ * 杩斿洖marker瀵硅薄鏁扮粍 * @param L leaflet瀵硅薄 */ + this.init = async (layer, L) => { - // const SolidWasteIcon = this.SolidWasteIcon() this.animalService = new AnimalService({ L: L, layer: layer @@ -56,30 +57,41 @@ direction: 'bottom', className: 'company-bindTooltip' }) */ - layer.addLayer(marker) + // layer.addLayer(marker) + if (window.map.getZoom() <= 5) { + layer.addLayer(marker) + } else if (window.map.getZoom() >= 12) { + layer.removeLayer() + } } } /* * 鐐逛綅榧犳爣绉诲叆寮规 * */ this.bindTooltip = (layer) => { - // console.log(layer) + // console.log(layer) return '<div class="company-bindTooltip-hover"><h3>姹℃煋鐗╀骇鐢熺粺璁�</h3><ul>' + - '<li>鐢熶骇璁炬柦锛�30锛堜釜锛�</li>' + - '<li>娌荤悊璁炬柦锛�30锛堜釜锛�</li>' + - '</ul></div>'// layer.options.test.name + '<li>鐢熶骇璁炬柦锛�30锛堜釜锛�</li>' + + '<li>娌荤悊璁炬柦锛�30锛堜釜锛�</li>' + + '</ul></div>'// layer.options.test.name } /* * 鐐逛綅鐐瑰嚮浜嬩欢 * * */ this.clickListener = (e) => { - // this.animalService.pulseEffect(e.latlng) - const dataValue = { - StoragePlaceId: e.layer.options.test.name + console.log(e) + window.map.setView(e.latlng, 13) + if (window.map.getZoom() >= 12) { + e.layer.remove() } - debugger - console.log(dataValue) - // return this.PublicBounced.$el + // if (window.map.getZoom() <= 5) { + // e.layer.addLayer() + // } else if (window.map.getZoom() >= 12) { + // e.layer.removeLayer() + // } + // const dataValue = { + // StoragePlaceId: e.layer.options.test.name + // } } } -- Gitblit v1.8.0