mirror of
https://github.com/Southampton-RSG/breccia-mapper.git
synced 2026-03-03 11:27:09 +00:00
@@ -1,5 +1,4 @@
|
||||
|
||||
let marker = null;
|
||||
let search_markers = []
|
||||
|
||||
/**
|
||||
@@ -7,9 +6,9 @@ let search_markers = []
|
||||
* @param {Event} event - Click event from a Google Map.
|
||||
*/
|
||||
function selectLocation(event) {
|
||||
if (marker === null) {
|
||||
if (selected_marker === null) {
|
||||
// Generate a new marker
|
||||
marker = new google.maps.Marker({
|
||||
selected_marker = new google.maps.Marker({
|
||||
position: event.latLng,
|
||||
map: map,
|
||||
icon: {
|
||||
@@ -24,10 +23,10 @@ function selectLocation(event) {
|
||||
},
|
||||
});
|
||||
} else {
|
||||
marker.setPosition(event.latLng);
|
||||
selected_marker.setPosition(event.latLng);
|
||||
}
|
||||
|
||||
const pos = marker.getPosition();
|
||||
const pos = selected_marker.getPosition();
|
||||
document.getElementById('id_latitude').value = pos.lat();
|
||||
document.getElementById('id_longitude').value = pos.lng();
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ const marker_edge_alpha = 1.0;
|
||||
const marker_edge_width = 1.0;
|
||||
|
||||
let map = null;
|
||||
let selected_marker = null;
|
||||
let selected_marker_info = null;
|
||||
|
||||
function createMarker(map, marker_data) {
|
||||
@@ -75,6 +76,9 @@ function initMap() {
|
||||
try {
|
||||
const marker = createMarker(map, marker_data);
|
||||
bounds.extend(marker.position);
|
||||
if (markers_data.length === 1) {
|
||||
selected_marker = marker;
|
||||
}
|
||||
|
||||
} catch (exc) {
|
||||
// Just skip and move on to next
|
||||
|
||||
Reference in New Issue
Block a user