Never let mouseCoordinates return NaN (fallback to map center)

This commit is contained in:
Bryan Housel
2018-01-19 11:53:14 -05:00
parent 9b99115b3e
commit 835d45ed6d
+3 -1
View File
@@ -511,8 +511,10 @@ export function rendererMap(context) {
};
// returns Lng/Lat
map.mouseCoordinates = function() {
return projection.invert(map.mouse());
var coord = map.mouse() || pxCenter();
return projection.invert(coord);
};