From 6cbec2e9d46bede9bc290669ff5ee227cefe9a2d Mon Sep 17 00:00:00 2001 From: Lene Wasskog <lene.wasskog@nibio.no> Date: Mon, 20 Jan 2025 08:42:52 +0100 Subject: [PATCH] fix: Errors when drawing on map [VIPSUTV-946] --- src/main/webapp/js/objectGISInfoMap.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/webapp/js/objectGISInfoMap.js b/src/main/webapp/js/objectGISInfoMap.js index b0bbf09b..cebeafc0 100755 --- a/src/main/webapp/js/objectGISInfoMap.js +++ b/src/main/webapp/js/objectGISInfoMap.js @@ -204,6 +204,11 @@ var app = window.app; // Transform the center coordinates from EPSG:4326 to EPSG:3857 const centerPosition = ol.proj.fromLonLat(center, 'EPSG:3857'); + view = new ol.View({ + center: centerPosition, + zoom: zoomLevel + }) + // Creating the map GISInfoMap = new ol.Map({ target: olMapDivId, // Defined at the top of this file @@ -216,10 +221,7 @@ var app = window.app; ]), layers: allLayers, renderer: 'canvas', - view: new ol.View({ - center: centerPosition, - zoom: zoomLevel - }) + view: view }); // Marker overlay -- GitLab