commit 5e2cee12db93467f1f378f5122a9c67d1d46dc98
parent 8e4b4385700334d0e1a3aadda37d54c56a0ee4cb
Author: Sergey Orlov <wladimirych@gmail.com>
Date: Fri, 29 May 2020 22:34:51 +0200
leaflet fixes: do duck typing check instead of instanceof for LatLng
This allows to pass simple objects with lng property instead of L.LatLng
Related to #258
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/lib/leaflet.fixes/fixWorldCopyJump.js b/src/lib/leaflet.fixes/fixWorldCopyJump.js
@@ -6,8 +6,8 @@ function shiftLongitudeToTarget(lng, targetLng) {
return 0;
}
targetLng = targetLng.getCenter().lng;
- } else if (targetLng instanceof L.LatLng) {
- targetLng = targetLng.lng;
+ } else {
+ targetLng = targetLng.lng ?? targetLng;
}
let shift = 0;
if (Math.abs(lng + 360 - targetLng) < Math.abs(lng - targetLng)) {