nakarte

Source code of https://map.sikmir.ru (fork)
git clone git://git.sikmir.ru/nakarte
Log | Files | Refs | LICENSE

commit a9f1308954f0cb9765681cbb8c4bdb57da043309
parent 73a73c428b4eefd9b22c1daf09e4954695830473
Author: Sergej Orlov <wladimirych@gmail.com>
Date:   Thu, 19 Jul 2018 02:08:07 +0300

[track profile] fix overflow of elevation values index #100

Diffstat:
Msrc/lib/leaflet.control.elevation-profile/index.js | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/lib/leaflet.control.elevation-profile/index.js b/src/lib/leaflet.control.elevation-profile/index.js @@ -348,6 +348,12 @@ const ElevationProfile = L.Class.extend({ }, xToIndex: function(x) { + if (x < 0) { + x = 0; + } + if (x > this.svgWidth - 1) { + x = this.svgWidth - 1; + } return x / (this.svgWidth - 1) * (this.values.length - 1); },