@@ -3,6 +3,7 @@ L.ObjectsLayer = L.GeoJSON.extend({
33 indexing : true ,
44 highlight : true ,
55 objectUrl : null ,
6+ displayPopup : true ,
67 styles : {
78 'default' : { 'color' : 'blue' , 'weight' : 2 , 'opacity' : 0.8 } ,
89 highlight : { 'color' : 'red' , 'weight' : 5 , 'opacity' : 1 } ,
@@ -70,24 +71,25 @@ L.ObjectsLayer = L.GeoJSON.extend({
7071 } , this ) ) ;
7172
7273 this . on ( 'click' , async function ( e ) {
73- var popup_content ;
74- try {
75- popup_content = await this . getPopupContent ( e . layer ) ;
76- } catch ( error ) {
77- popup_content = gettext ( 'Data unreachable' ) ;
78- }
79- if ( e . target . _popup ) {
80- // update popup content if it has been already bind
81- var popup = e . target . _popup ;
82- popup . setContent ( popup_content ) ;
83- popup . update ( ) ;
84- } else {
85- // bind a new popup
86- this . bindPopup ( popup_content ) . openPopup ( e . latlng ) ;
74+ if ( this . options . displayPopup ) {
75+ var popup_content ;
76+ try {
77+ popup_content = await this . getPopupContent ( e . layer ) ;
78+ } catch ( error ) {
79+ popup_content = gettext ( 'Data unreachable' ) ;
80+ }
81+ if ( e . target . _popup ) {
82+ // update popup content if it has been already bind
83+ var popup = e . target . _popup ;
84+ popup . setContent ( popup_content ) ;
85+ popup . update ( ) ;
86+ } else {
87+ // bind a new popup
88+ this . bindPopup ( popup_content ) . openPopup ( e . latlng ) ;
89+ }
8790 }
8891 } , this ) ;
8992
90-
9193 var dataurl = null ;
9294 if ( typeof ( geojson ) == 'string' ) {
9395 dataurl = geojson ;
@@ -250,7 +252,7 @@ L.ObjectsLayer = L.GeoJSON.extend({
250252 throw new Error ( 'Cannot parse data' ) ;
251253 }
252254 }
253- }
255+ } ,
254256
255257} ) ;
256258
0 commit comments