Handle Polylines with empty array of LatLngs (#5498)

Fixes #5497
This commit is contained in:
Per Liedman 2017-05-04 10:05:15 +02:00 committed by Iván Sánchez Ortega
parent 4a65730087
commit 222bc47a0d
2 changed files with 7 additions and 5 deletions

View File

@ -203,10 +203,12 @@ export var Canvas = Renderer.extend({
},
_extendRedrawBounds: function (layer) {
var padding = (layer.options.weight || 0) + 1;
this._redrawBounds = this._redrawBounds || new Bounds();
this._redrawBounds.extend(layer._pxBounds.min.subtract([padding, padding]));
this._redrawBounds.extend(layer._pxBounds.max.add([padding, padding]));
if (layer._pxBounds) {
var padding = (layer.options.weight || 0) + 1;
this._redrawBounds = this._redrawBounds || new Bounds();
this._redrawBounds.extend(layer._pxBounds.min.subtract([padding, padding]));
this._redrawBounds.extend(layer._pxBounds.max.add([padding, padding]));
}
},
_redraw: function () {

View File

@ -295,7 +295,7 @@ export var Polyline = Path.extend({
var i, j, k, len, len2, part,
w = this._clickTolerance();
if (!this._pxBounds.contains(p)) { return false; }
if (!this._pxBounds || !this._pxBounds.contains(p)) { return false; }
// hit detection for polylines
for (i = 0, len = this._parts.length; i < len; i++) {