From 6aba1fcb16b13aa73de1f4f026ac4fdb7ddba3e7 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Thu, 6 Jun 2019 11:32:06 +0200 Subject: [PATCH] updated version history and added some more typecasting checks --- HISTORY.md | 3 +++ snap.html | 2 +- src/maps.js | 8 ++++---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 025410f8..37a93bfa 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -86,6 +86,9 @@ * German * French +### 2019-06-06 +* Maps: fixed a typecasting issue, thanks, Bernat! + ### 2019-06-04 * Objects, Lists: fixed #682 * Lists, Tables: fixed table watcher cell updates for costumes (save / load) diff --git a/snap.html b/snap.html index ff746b87..b4684a15 100755 --- a/snap.html +++ b/snap.html @@ -17,7 +17,7 @@ - + diff --git a/src/maps.js b/src/maps.js index 10ae95ef..6448a0e8 100644 --- a/src/maps.js +++ b/src/maps.js @@ -38,7 +38,7 @@ // Global stuff //////////////////////////////////////////////////////// -modules.maps = '2019-May-28'; +modules.maps = '2019-June-06'; // WorldMap ///////////////////////////////////////////////////////////// @@ -237,10 +237,10 @@ WorldMap.prototype.snapYfromLat = function (lat) { WorldMap.prototype.distanceInKm = function(lat1, lon1, lat2, lon2) { // haversine formula: var R = 6371, // radius of the earth in km - dLat = radians(lat2 - lat1), - dLon = radians(lon2 - lon1), + dLat = radians(+lat2 - lat1), + dLon = radians(+lon2 - lon1), a = Math.sin(dLat/2) * Math.sin(dLat/2) + - Math.cos(radians(lat1)) * Math.cos(radians(lat2)) * + Math.cos(radians(+lat1)) * Math.cos(radians(+lat2)) * Math.sin(dLon/2) * Math.sin(dLon/2), c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); return R * c;