Skip to content
Snippets Groups Projects
Commit 21b2ccfe authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Mehrere Kleinigkeiten:

* Der "X"-Knopf in der Suchleiste entfernt nun Korrekt alle Elemente auf der Karte
* Beim Aufruf einer Suche in der angegebenen Boundingbox zoomt die Karte nun korrekt vor der Suche in den angegebenen Bereich.
* Das "moveend" event der Karte wird nun erst nach einer durchgeführten Suche belegt
parent a5337c39
Branches
No related tags found
No related merge requests found
Source diff could not be displayed: it is too large. Options to address this: view the blob.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -128,7 +128,15 @@ function adjustView(results) {
}
minPosition = ol.proj.transform(minPosition, 'EPSG:4326', 'EPSG:3857');
maxPosition = ol.proj.transform(maxPosition, 'EPSG:4326', 'EPSG:3857');
map.getView().fitExtent([minPosition[0], minPosition[1], maxPosition[0], maxPosition[1]], map.getSize())
map.getView().fitExtent([minPosition[0], minPosition[1], maxPosition[0], maxPosition[1]], map.getSize());
updateMapExtent();
}
function adjustViewBoundingBox(minpos,maxpos){
minPosition = ol.proj.transform(minpos, 'EPSG:4326', 'EPSG:3857');
maxPosition = ol.proj.transform(maxpos, 'EPSG:4326', 'EPSG:3857');
map.getView().fitExtent([minPosition[0], minPosition[1], maxPosition[0], maxPosition[1]], map.getSize());
updateMapExtent();
}
function clearPOIS(){
......
$(document).ready(function() {
if(!boundings)
if(!boundings && getPosition)
receiveLocation();
if(boundings){
adjustViewBoundingBox(minPos,maxPos);
}
$("#clearInput").click(function() {
$("#search input[name=q]").val('');
$("#search input[name=q]").focus();
$("#results > .result").remove();
clearPOIS();
$("#results").addClass("hidden");
$.each(overlays, function(index, value){
map.removeOverlay(value);
......@@ -26,18 +29,7 @@ $(document).ready(function() {
});
$("#search input[name=q]").blur();
});
// Register Map Changed Event
map.on("moveend", function(){
var q = $("#search input[name=q]").val();
if(q !== ""){
updateMapExtent();
var q = $("#search input[name=q]").val();
q = encodeURI(q);
$("#clearInput").html("<img src=\"/img/ajax-loader.gif\" />");
var url = '/' + q + '/' + encodeURI(extent[0]) + '/' + encodeURI(extent[1]) + '/' + encodeURI(extent[2]) + '/' + encodeURI(extent[3]+'/'+false+'/50');
$.getScript(url);
}
}, map);
});
function initMap() {
......@@ -87,4 +79,16 @@ function initMap() {
$(this).blur();
return false;
});
}
\ No newline at end of file
}
var moveFunction = function(){
var q = $("#search input[name=q]").val();
if(q !== ""){
updateMapExtent();
var q = $("#search input[name=q]").val();
q = encodeURI(q);
$("#clearInput").html("<img src=\"/img/ajax-loader.gif\" />");
var url = '/' + q + '/' + encodeURI(extent[0]) + '/' + encodeURI(extent[1]) + '/' + encodeURI(extent[2]) + '/' + encodeURI(extent[3]+'/'+false+'/50');
$.getScript(url);
}
}
\ No newline at end of file
......@@ -79,6 +79,11 @@
</main>
<script>
var boundings = {{$boundings}};
@if($boundings === 'true')
var minPos = {{$minPos}};
var maxPos = {{$maxPos}};
@endif
var getPosition = {{$getPosition}};
</script>
<script src="/js/mapSearch.js">
</script>
......
var searchResults = {!! $results !!};
map.un("moveend", moveFunction, map);
clearPOIS();
var markers = [];
......@@ -126,6 +126,9 @@ adjustView(searchResults);
$(".collapse").collapse("hide");
$("#clearInput").html('<span class="font-bold">X</span>');
// Add the research function after the map moved
map.on("moveend", moveFunction, map);
@if($adjustLink)
var stateObj = { url: '/{{$search . "/" . $bounds[0] . "/" . $bounds[1] . "/" . $bounds[2] . "/" . $bounds[3]}}'};
// Change URL
......
......@@ -12,11 +12,11 @@
*/
Route::get('/', function () {
return view('map')->with('boundings', 'false');
return view('map')->with('boundings', 'false')->with('getPosition', 'true');
});
Route::get('map/{search}/{latMin}/{lonMin}/{latMax}/{lonMax}', function ($search, $latMin, $lonMin, $latMax, $lonMax) {
return view('map')->with('javascript', "/$search/$latMin/$lonMin/$latMax/$lonMax")->with('search', $search)->with('boundings', 'true');
return view('map')->with('javascript', "/$search/$latMin/$lonMin/$latMax/$lonMax")->with('search', $search)->with('boundings', 'true')->with('getPosition', 'false')->with('minPos', json_encode([floatval($latMin), floatval($lonMin)]))->with('maxPos', json_encode([floatval($latMax), floatval($lonMax)]));
});
Route::get('{search}/{latMin}/{lonMin}/{latMax}/{lonMax}/{adjustView?}/{limit?}', 'SearchController@boundingBoxSearch');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment