Fix bug with weird clipping behaviour (cause of #125)
This commit is contained in:
parent
6353ef9e20
commit
9c671f4735
|
@ -52,12 +52,20 @@ export class FilteredLayer {
|
||||||
|
|
||||||
this._wayHandling = layerDef.wayHandling;
|
this._wayHandling = layerDef.wayHandling;
|
||||||
this._showOnPopup = showOnPopup;
|
this._showOnPopup = showOnPopup;
|
||||||
this._style = layerDef.style;
|
this._style = (tags) => {
|
||||||
if (this._style === undefined) {
|
if(layerDef.style === undefined){
|
||||||
this._style = function () {
|
|
||||||
return {icon: {iconUrl: "./assets/bug.svg"}, color: "#000"};
|
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.name = name;
|
||||||
this.filters = layerDef.overpassFilter;
|
this.filters = layerDef.overpassFilter;
|
||||||
this._maxAllowedOverlap = layerDef.maxAllowedOverlapPercentage;
|
this._maxAllowedOverlap = layerDef.maxAllowedOverlapPercentage;
|
||||||
|
@ -215,26 +223,26 @@ export class FilteredLayer {
|
||||||
pointToLayer: function (feature, latLng) {
|
pointToLayer: function (feature, latLng) {
|
||||||
const style = self._style(feature.properties);
|
const style = self._style(feature.properties);
|
||||||
let marker;
|
let marker;
|
||||||
if (style.icon === undefined) {
|
if (style.icon === undefined) {
|
||||||
marker = L.circle(latLng, {
|
marker = L.circle(latLng, {
|
||||||
radius: 25,
|
radius: 25,
|
||||||
color: style.color
|
color: style.color
|
||||||
});
|
});
|
||||||
|
|
||||||
} else if (style.icon.iconUrl.startsWith("$circle")) {
|
} else if (style.icon.iconUrl.startsWith("$circle")) {
|
||||||
marker = L.circle(latLng, {
|
marker = L.circle(latLng, {
|
||||||
radius: 25,
|
radius: 25,
|
||||||
color: style.color
|
color: style.color
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (style.icon.iconSize === undefined) {
|
if (style.icon.iconSize === undefined) {
|
||||||
style.icon.iconSize = [50, 50]
|
style.icon.iconSize = [50, 50]
|
||||||
}
|
}
|
||||||
|
|
||||||
marker = L.marker(latLng, {
|
marker = L.marker(latLng, {
|
||||||
icon: new L.icon(style.icon),
|
icon: new L.icon(style.icon),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
let eventSource = State.state.allElements.addOrGetElement(feature);
|
let eventSource = State.state.allElements.addOrGetElement(feature);
|
||||||
const popup = L.popup({}, marker);
|
const popup = L.popup({}, marker);
|
||||||
let uiElement: UIElement;
|
let uiElement: UIElement;
|
||||||
|
|
Loading…
Reference in a new issue