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