From 7fbce1ecd95b4e12ceda0a5b874ec8f3951625f7 Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期五, 17 一月 2025 17:58:59 +0800 Subject: [PATCH] WI水务智能助理 --- src/model/map/OLMap.ts | 25 ++++++++++++++++++++++++- 1 files changed, 24 insertions(+), 1 deletions(-) diff --git a/src/model/map/OLMap.ts b/src/model/map/OLMap.ts index 2385085..55c97df 100644 --- a/src/model/map/OLMap.ts +++ b/src/model/map/OLMap.ts @@ -258,8 +258,31 @@ } private addBasicControl() { - this.map.addControl(new ZoomSlider()); + // this.map.addControl(new ZoomSlider()); // this.map.addControl(new FullScreen()); + const container = this.map.getViewport(); + if (!container) return; + const olZoom = container.querySelector('.ol-zoom') as HTMLElement; + if (!olZoom) return; + olZoom.style.display = 'none'; + } + + /** + * 鏀惧ぇ鍦板浘 + */ + zoomIn() { + const view = this.map.getView(); + const zoom = view.getZoom(); + view.setZoom(zoom + 1); + } + + /** + * 缂╁皬鍦板浘 + */ + zoomOut() { + const view = this.map.getView(); + const zoom = view.getZoom(); + view.setZoom(zoom - 1); } getWMTS = () => { -- Gitblit v1.9.3