我试图在鼠标移动时获取 x,y 坐标。当我尝试获取它时,我遇到了错误。
TypeError:无法在 HTMLDivElement.onmousemove(仪表板:442)的 mouseMove(仪表板:593)处读取未定义的属性“latlng”
<div id="map" onmousemove="mouseMove()"></div>
<script type="text/javascript">
var iMaxZoom = 1;
var map = L.map('map', {
crs: L.CRS.Simple,
minZoom: -5,
maxZoom: 1
});
var bounds = [[0,0], [711,473]];
var image = L.imageOverlay('{!! asset('assets/images/birlikmarket.png') !!}', bounds).addTo(map);
map.fitBounds(bounds);
// mouse move detect x, y coordinates
function mouseMove(e) {
var tileSize = [711,473]
try {
console.log(e.latlng)
}catch(error) {
console.log(error)
}
}
</script>