Explorar o código

Map getUserLocation: zoom to location even if record is not selected

Piotr Labudda %!s(int64=11) %!d(string=hai) anos
pai
achega
c45353bcdc
Modificáronse 1 ficheiros con 4 adicións e 4 borrados
  1. 4 4
      SE/se-lib/TableAjaxMap.php

+ 4 - 4
SE/se-lib/TableAjaxMap.php

@@ -276,10 +276,6 @@ OpenLayers.ProxyHost = "index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_
 					title: "Twoja lokalizacja",
 					displayClass: "olControlUserLocation",
 					trigger: function() {
-						if (!priv.isSelectedRecordId()) {
-							alert('Najpierw wybierz rekord z tabeli, żeby móc narysować dla niego figurę.');
-							return false;
-						}
 						if (navigator.geolocation) {
 							navigator.geolocation.getCurrentPosition(drawFromUserLocation);
 						} else { 
@@ -289,6 +285,10 @@ OpenLayers.ProxyHost = "index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_
 							var coords = position.coords;
 							console.log("Latitude: " + coords.latitude + "<br>Longitude: " + coords.longitude);
 							publ.zoomToExtent('POINT(' + coords.longitude + ' ' + coords.latitude + ')');
+							if (!priv.isSelectedRecordId()) {
+								alert('Najpierw wybierz rekord z tabeli, żeby móc narysować dla niego figurę.');
+								return false;
+							}
 							setTimeout(function() {
 								var geometry = new OpenLayers.Geometry.Point(coords.longitude, coords.latitude);
 								var sourceProj = new OpenLayers.Projection("EPSG:4326");