@@ -279,17 +279,26 @@ function osm_get_js($conf, $local_conf, $js_data)
279279 $ divname = isset ($ local_conf ['divname ' ]) ? $ local_conf ['divname ' ] : 'map ' ;
280280
281281 /* If the config include parameters get them */
282- $ zoom = isset ($ conf ['osm_conf ' ]['left_menu ' ]['zoom ' ]) ? $ conf ['osm_conf ' ]['left_menu ' ]['zoom ' ] : 2 ;
283282 $ center = isset ($ conf ['osm_conf ' ]['left_menu ' ]['center ' ]) ? $ conf ['osm_conf ' ]['left_menu ' ]['center ' ] : '0,0 ' ;
284283 $ center_arr = preg_split ('/,/ ' , $ center );
285284 $ center_lat = isset ($ center_arr ) ? $ center_arr [0 ] : 0 ;
286285 $ center_lng = isset ($ center_arr ) ? $ center_arr [1 ] : 0 ;
287286
288287 /* If we have zoom and center coordonate, set it otherwise fallback default */
289- $ zoom = isset ($ _GET ['zoom ' ]) ? $ _GET ['zoom ' ] : $ zoom ;
288+ $ zoom = isset ($ _GET ['zoom ' ])
289+ ? $ _GET ['zoom ' ]
290+ : (
291+ isset ($ local_conf ['zoom ' ])
292+ ? $ local_conf ['zoom ' ]
293+ : 2
294+ );
290295 $ center_lat = isset ($ _GET ['center_lat ' ]) ? $ _GET ['center_lat ' ] : $ center_lat ;
291296 $ center_lng = isset ($ _GET ['center_lng ' ]) ? $ _GET ['center_lng ' ] : $ center_lng ;
292297
298+ $ autocenter = isset ($ local_conf ['autocenter ' ])
299+ ? $ local_conf ['autocenter ' ]
300+ : 0 ;
301+
293302 // Load baselayerURL
294303 if ($ baselayer == 'mapnik ' ) $ baselayerurl = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png ' ;
295304 else if ($ baselayer == 'mapquest ' ) $ baselayerurl = 'http://otile1.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png ' ;
@@ -344,7 +353,7 @@ function osm_get_js($conf, $local_conf, $js_data)
344353 $ js .= "\nvar Url = ' " .$ baselayerurl ."',
345354 Attribution = ' " .$ attribution ."',
346355 TileLayer = new L.TileLayer(Url, {maxZoom: 18, noWrap: " .$ nowarp .", attribution: Attribution}); \n" ;
347- $ js .= "var " . $ divname . " = new L.Map(' " . $ divname . "', { " . $ worldcopyjump . ", zoom: " .$ local_conf [ ' zoom ' ] .", layers: [TileLayer], contextmenu: " . $ local_conf ['contextmenu ' ] . "}); \n" ;
356+ $ js .= "var " . $ divname . " = new L.Map(' " . $ divname . "', { " . $ worldcopyjump . ", zoom: " .$ zoom .", layers: [TileLayer], contextmenu: " . $ local_conf ['contextmenu ' ] . "}); \n" ;
348357 $ js .= $ divname . ".attributionControl.setPrefix(''); \n" ;
349358 $ js .= "\nL.control.scale().addTo( " . $ divname . "); \n" ;
350359 return $ js ;
@@ -354,7 +363,7 @@ function osm_get_js($conf, $local_conf, $js_data)
354363 Attribution = ' " .$ attribution ."',
355364 TileLayer = new L.TileLayer(Url, {maxZoom: 18, noWrap: " .$ nowarp .", attribution: Attribution}),
356365 latlng = new L.LatLng( " .$ local_conf ['center_lat ' ].", " .$ local_conf ['center_lng ' ]."); \n" ;
357- $ js .= "var " . $ divname . " = new L.Map(' " . $ divname . "', { " . $ worldcopyjump . ", center: latlng, " .$ editor ." zoom: " .$ local_conf [ ' zoom ' ] .", layers: [TileLayer], contextmenu: " . $ local_conf ['contextmenu ' ] . "}); \n" ;
366+ $ js .= "var " . $ divname . " = new L.Map(' " . $ divname . "', { " . $ worldcopyjump . ", center: latlng, " .$ editor ." zoom: " .$ zoom .", layers: [TileLayer], contextmenu: " . $ local_conf ['contextmenu ' ] . "}); \n" ;
358367 $ js .= $ divname . ".attributionControl.setPrefix(''); \n" ;
359368 $ js .= "var MarkerClusterList=[]; \n" ;
360369 $ js .= "if (typeof L.MarkerClusterGroup === 'function') \n" ;
@@ -508,7 +517,7 @@ function osm_get_js($conf, $local_conf, $js_data)
508517 }
509518 $ js .= "\nif (typeof L.MarkerClusterGroup === 'function') \n" ;
510519 $ js .= " " . $ divname . ".addLayer(markers); \n" ;
511- if (isset ( $ local_conf [ ' auto_center ' ]) and $ local_conf [ ' auto_center ' ] === 0 ) {
520+ if ( $ autocenter ) {
512521 $ js .= "var group = new L.featureGroup(MarkerClusterList); " ;
513522 $ js .= "this. " . $ divname . ".whenReady(function () {
514523 window.setTimeout(function () {
0 commit comments