[mylocation] add title to save button; tweak button ids; add null check to locate-marker if

pull/3699/head
Logan B 2024-12-22 15:37:55 -06:00
parent 12ef79ec1e
commit 8cb20f771c
1 changed files with 7 additions and 7 deletions

View File

@ -35,9 +35,9 @@
</div> </div>
<div id="controls"> <div id="controls">
<span id="select-hint">Click the map to select a location</span> <span id="select-hint">Click the map to select a location</span>
<button id="locate" class="btn" title="Locate me">&#x26ef;</button> <button id="locate-me" class="btn" title="Locate me">&#x26ef;</button>
<button id="find-marker" class="btn" style="display:none" title="Locate marker"><i class="icon icon-location"></i></button> <button id="locate-marker" class="btn" style="display:none" title="Locate marker"><i class="icon icon-location"></i></button>
<button id="select" class="btn btn-primary" style="display:none">Save</button><br/> <button id="select" class="btn btn-primary" style="display:none" title="Save to device">Save</button><br/>
</div> </div>
<script src="../../core/lib/interface.js"></script> <script src="../../core/lib/interface.js"></script>
@ -82,7 +82,7 @@
document.getElementById("select-hint").style.display="none"; document.getElementById("select-hint").style.display="none";
document.getElementById("select").style.display=""; document.getElementById("select").style.display="";
document.getElementById("find-marker").style.display=""; document.getElementById("locate-marker").style.display="";
} }
map.on('click', function(e){ map.on('click', function(e){
@ -97,12 +97,12 @@
return {lat: file.lat, lng: file.lon}; return {lat: file.lat, lng: file.lon};
} }
document.getElementById("locate").addEventListener("click", function() { document.getElementById("locate-me").addEventListener("click", function() {
map.locate({setView: true, maxZoom: 16, enableHighAccuracy:true}); map.locate({setView: true, maxZoom: 16, enableHighAccuracy:true});
}); });
document.getElementById("find-marker").addEventListener("click", function() { document.getElementById("locate-marker").addEventListener("click", function() {
if(latlon && latlon.lng && latlon.lat) { if (latlon && latlon.lng != null && latlon.lat != null) {
map.setView(latlon); map.setView(latlon);
} }
}); });