var locationFilter = new L.LocationFilter({
enableButton: false,
- adjustButton: false,
- onChange: filterChanged
+ adjustButton: false
}).addTo(map);
+ locationFilter.on("change", filterChanged);
+
map.on("moveend", mapMoved);
map.on("baselayerchange", htmlUrlChanged);
map.off("moveend", mapMoved);
map.off("baselayerchange", htmlUrlChanged);
+ locationFilter.off("change", filterChanged);
});
function getBounds() {
var bounds = getBounds();
map.fitBounds(bounds);
-
- enableFilter();
locationFilter.setBounds(bounds);
+ enableFilter();
validateControls();
mapnikSizeChanged();
}
function enableFilter() {
+ if (!locationFilter.getBounds().isValid()) {
+ locationFilter.setBounds(map.getBounds().pad(-0.2));
+ }
+
$("#drag_box").hide();
locationFilter.enable();
}