Skip to content
Snippets Groups Projects
Commit c7252a30 authored by Lene Wasskog's avatar Lene Wasskog
Browse files

feat: Ensure that changes in coordinate input fields are reflected in map

parent 9f45c0ca
Branches
No related tags found
No related merge requests found
...@@ -211,22 +211,6 @@ ...@@ -211,22 +211,6 @@
inputLatitudeElement.value = selectedLatitude; inputLatitudeElement.value = selectedLatitude;
inputLongitudeElement.value = selectedLongitude; inputLongitudeElement.value = selectedLongitude;
} }
selectedPoint = 1;
selectedFeature = {
"type": "FeatureCollection", "features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [selectedLongitude, selectedLatitude]
},
"properties": {
"pointOfInterestId": selectedPoint,
"pointOfInterestName": coordinatesData.name,
}
}]
};
} }
function selectPoi(poiData) { function selectPoi(poiData) {
...@@ -244,6 +228,27 @@ ...@@ -244,6 +228,27 @@
} }
window.openCoordinatesMap = () => { window.openCoordinatesMap = () => {
if (inputLatitudeElement.value && inputLongitudeElement.value) {
selectedPoint = 1;
selectedFeature = {
"type": "FeatureCollection", "features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [parseFloat(inputLongitudeElement.value), parseFloat(inputLatitudeElement.value)]
},
"properties": {
"pointOfInterestId": selectedPoint,
"pointOfInterestName": "Punkt",
}
}]
};
} else {
selectedPoint = undefined;
selectedFeature = undefined;
}
const coordinatesMapInstance = new MapModal('coordinates-map', {}, selectedFeature, 'nb', true, selectCoordinates); const coordinatesMapInstance = new MapModal('coordinates-map', {}, selectedFeature, 'nb', true, selectCoordinates);
coordinatesMapInstance.openModal(selectedPoint); coordinatesMapInstance.openModal(selectedPoint);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment