Commit 3490bc80 authored by Matija Obreza's avatar Matija Obreza
Browse files

Improved area selection in map, better button position

parent dc4f83db
......@@ -13,20 +13,17 @@
<div class="main-col-header clearfix">
<div class="nav-header">
<form class="pull-right form-horizontal" method="post" action="/explore/kml">
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
<input type="hidden" name="crop" value="${crop.shortName}" />
<input type="hidden" name="filter" value="<c:out value="${jsonFilter}" />" />
<div class="row">
<div class="col-sm-4">
<button class="btn btn-default" type="submit"><spring:message code="download.kml" /></button>
</div>
</div>
</form>
<div class="pull-right">
<a class="btn btn-default" href="<c:url value="/explore" />" id="selectArea"><spring:message code="view.accessions" /></a>
<form class="form-horizontal pull-right" method="post" action="/explore/kml">
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
<input type="hidden" name="crop" value="${crop.shortName}" />
<input type="hidden" name="filter" value="<c:out value="${jsonFilter}" />" />
<button class="btn btn-default" type="submit"><spring:message code="download.kml" /></button>
</form>
</div>
<div class="results">
<a href="javascript: window.history.go(-1);"><spring:message code="navigate.back" /></a>
<a class="" href="<c:url value="/explore" />" id="selectArea">View accessions</a>
</div>
</div>
</div>
......@@ -57,7 +54,8 @@
$("#selectArea").hide();
var filterJson=${jsonFilter};
var locationFilter = new L.LocationFilter().addTo(map);
var locationFilter = new L.LocationFilter({adjustButton: false, bounds: map.getBounds().pad(-0.1) }).addTo(map);
locationFilter.on("change", function (e) {
// Do something when the bounds change.
// Bounds are available in `e.bounds`.
......@@ -66,6 +64,12 @@
filterJson.longitude=[{range:[bounds.getWest(),bounds.getEast()]}];
});
map.on("viewreset", function() {
if (locationFilter.isEnabled())
return;
var mapBounds=map.getBounds().pad(-0.1);
locationFilter.setBounds(mapBounds);
});
locationFilter.on("enabled", function () {
// Do something when enabled.
var bounds=locationFilter.getBounds();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment