From 3e2d8fe73082480f8ecf2144b9e8b831c84c8dca Mon Sep 17 00:00:00 2001 From: b_b Date: Fri, 29 Oct 2021 16:23:06 +0200 Subject: [PATCH] nouvelle option : centrer/autocenter qui fait pareil que autocenterandzoom sans modifier le zoom fix #12 --- javascript/leaflet.gis.js | 7 +++++++ modeles/carte_gis.html | 1 + 2 files changed, 8 insertions(+) diff --git a/javascript/leaflet.gis.js b/javascript/leaflet.gis.js index b51d7ef..660d6b6 100644 --- a/javascript/leaflet.gis.js +++ b/javascript/leaflet.gis.js @@ -29,6 +29,7 @@ L.Map.Gis = L.Map.extend({ }, pathStyles: null, autocenterandzoom: false, + autocenter: false, openId: false, affiche_points: true, json_points: { @@ -275,6 +276,9 @@ L.Map.Gis = L.Map.extend({ if (map.options.autocenterandzoom) { this.centerAndZoom(map.markerCluster.getBounds()); } + if (map.options.autocenter) { + this.centerAndZoom(map.markerCluster.getBounds(), true); + } if (map.options.openId) { gis_focus_marker(map.options.openId,map.options.mapId); } @@ -311,6 +315,9 @@ L.Map.Gis = L.Map.extend({ if (map.options.autocenterandzoom) { this.centerAndZoom(geojson.getBounds()); } + if (map.options.autocenter) { + this.centerAndZoom(geojson.getBounds(), true); + } if (map.options.openId) gis_focus_marker(map.options.openId,map.options.mapId); diff --git a/modeles/carte_gis.html b/modeles/carte_gis.html index 63a6320..8dd3b7a 100644 --- a/modeles/carte_gis.html +++ b/modeles/carte_gis.html @@ -146,6 +146,7 @@ var jQgisloader; }, pathStyles: [(#ENV*{path_styles}|json_encode)], autocenterandzoom: [(#ENV{autocenterandzoom,#ENV{centrer_auto,non}}|trim|=={non}|?{false,true})], + autocenter: [(#ENV{autocenter,#ENV{centrer,non}}|trim|=={non}|?{false,true})], openId: [(#ENV{id_a_ouvrir,false})], localize_visitor: [(#ENV{localize_visitor,#ENV{localiser_visiteur}}|trim|?{true,false})], localize_visitor_zoom: [(#ENV{localize_visitor_zoom,#ENV{zoom,#CONFIG{gis/zoom,0}}}|trim)],