Update leaflet polyline plugin
authorTom Hughes <tom@compton.nu>
Thu, 13 Aug 2015 15:59:27 +0000 (16:59 +0100)
committerTom Hughes <tom@compton.nu>
Thu, 13 Aug 2015 15:59:27 +0000 (16:59 +0100)
vendor/assets/leaflet/leaflet.polyline.js

index 5f35ed0..fc59aa3 100644 (file)
@@ -18,7 +18,9 @@
        var defaultOptions = function (options) {
                if (typeof options === 'number') {
                        // Legacy
-                       options = { precision: options };
+                       options = {
+                               precision: options
+                       };
                } else {
                        options = options || {};
                }
@@ -95,7 +97,7 @@
                        var numbers = this.decodeFloats(encoded, options);
                        for (var i = 0, len = numbers.length; i < len;) {
                                for (var d = 0; d < options.dimension; ++d, ++i) {
-                                       numbers[i] = lastNumbers[d] = numbers[i] + (lastNumbers[d] || 0);
+                                       numbers[i] = Math.round((lastNumbers[d] = numbers[i] + (lastNumbers[d] || 0)) * options.factor) / options.factor;
                                }
                        }