Fix bug with weird clipping behaviour (cause of #125)

This commit is contained in:
Pieter Vander Vennet 2020-09-25 23:10:40 +02:00
parent 6353ef9e20
commit 9c671f4735

View file

@ -52,12 +52,20 @@ export class FilteredLayer {
this._wayHandling = layerDef.wayHandling;
this._showOnPopup = showOnPopup;
this._style = layerDef.style;
if (this._style === undefined) {
this._style = function () {
this._style = (tags) => {
if(layerDef.style === undefined){
return {icon: {iconUrl: "./assets/bug.svg"}, color: "#000"};
}
const obj = layerDef.style(tags);
if(obj.weight && typeof (obj.weight) === "string"){
obj.weight = Number(obj.weight);// Weight MUST be a number, otherwise leaflet does weird things. see https://github.com/Leaflet/Leaflet/issues/6075
if(isNaN(obj.weight)){
obj.weight = undefined;
}
}
return obj;
};
this.name = name;
this.filters = layerDef.overpassFilter;
this._maxAllowedOverlap = layerDef.maxAllowedOverlapPercentage;