浏览代码

[enh] template_oscar: maxZoom if fitting bounds

Thomas Pointhuber 10 年前
父节点
当前提交
b2c976a5a3
共有 1 个文件被更改,包括 5 次插入3 次删除
  1. 5
    3
      searx/static/oscar/js/scripts.js

+ 5
- 3
searx/static/oscar/js/scripts.js 查看文件

100
             if(map_bounds) {
100
             if(map_bounds) {
101
                 // TODO hack: https://github.com/Leaflet/Leaflet/issues/2021
101
                 // TODO hack: https://github.com/Leaflet/Leaflet/issues/2021
102
                 setTimeout(function () {
102
                 setTimeout(function () {
103
-                    map.fitBounds(map_bounds);
103
+                    map.fitBounds(map_bounds, {
104
+                        maxZoom:17
105
+                    });
104
                 }, 0);
106
                 }, 0);
105
             } else if (map_lon && map_lat) {
107
             } else if (map_lon && map_lat) {
106
                 if(map_zoom) 
108
                 if(map_zoom) 
113
 
115
 
114
             if(map_geojson)
116
             if(map_geojson)
115
                 L.geoJson(map_geojson).addTo(map);
117
                 L.geoJson(map_geojson).addTo(map);
116
-	        //if(map_bounds)
117
-	        //    L.rectangle(map_bounds, {color: "#ff7800", weight: 3, fill:false}).addTo(map);
118
+            /*else if(map_bounds)
119
+                L.rectangle(map_bounds, {color: "#ff7800", weight: 3, fill:false}).addTo(map);*/
118
         });
120
         });
119
 
121
 
120
         // this event occour only once per element
122
         // this event occour only once per element