How to get the mouse coordinates stored in a variable in open layers?
How to get the mouse coordinates stored in a variable in open layers? I have a code that displays the mouse position outside of the map in openlayers ! what if I want to save those coordinates when I call the js mouse events onmousedown and onmouseup ? I have the following code : const mousePositionControl = new MousePosition({ coordinateFormat: createStringXY(4), projection: 'EPSG:4326', className: 'custom-mouse-position', target: document.getElementById('mouse-position'), undefinedHTML: ' ' }); const map = new Map({ controls: defaultControls({ attributionOptions: { collapsible: false } }).extend([mousePositionControl]), layers: [ new TileLayer({ source: new OSM() }) ], target: 'map', view: new View({ center: [0, 0], zoom: 2 }) }); 1 Answer 1 ...