JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3&dummy=.js"></script>
<div id="myMap"></div>
CSS
#myMap {
width: 500px;
height: 500px;
overflow: hidden;
}
JavaScript
//trap JS errors
onerror = function() {
return true;
};
var points = [],
shapeCreated = false;
function GetMap() {
map = new VEMap('myMap');
map.SetDashboardSize(VEDashboardSize.Tiny);
var latLong = new VELatLong(16.864061, -99.882588);
map.LoadMap();
map.SetCenterAndZoom(latLong, 15);
map.AttachEvent("onclick", MouseHandler);
map.AttachEvent("ondoubleclick", MouseHandler);
}
function MouseHandler(e) {
try {
var pixel = new VEPixel(e.mapX, e.mapY);
var latLong = map.PixelToLatLong(pixel);
points.push(latLong);
} catch (e) {
console.error(e);
}
}
GetMap()