From 771704bf15515ac524724c20399a0b44ccc44531 Mon Sep 17 00:00:00 2001 From: Markus Koch Date: Sat, 25 Apr 2020 13:08:14 +0200 Subject: Add basic support for city outlines Use with load_geojson( "Cities (outline, demo)", "./geojson/cities_demo.json", "outline", "black", 1, style_outlines); --- htdocs/leafletjs/Leaflet.streetlabels.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'htdocs/leafletjs') diff --git a/htdocs/leafletjs/Leaflet.streetlabels.js b/htdocs/leafletjs/Leaflet.streetlabels.js index 91bd596..8aee67b 100644 --- a/htdocs/leafletjs/Leaflet.streetlabels.js +++ b/htdocs/leafletjs/Leaflet.streetlabels.js @@ -80,10 +80,8 @@ L.StreetLabels = L.LabelTextCollision ctx.lineWidth = this.options.fontStyle.lineWidth; var fontSize = this.options.fontStyle.fontSize; - if (this._map && this.options.fontStyle.dynamicFontSize === true) { - fontSize = this._getDynamicFontSize(); - + fontSize = this._getDynamicFontSize(layer.feature); } ctx.font = fontSize + this.options.fontStyle.fontSizeUnit + " 'Helvetica Neue',Helvetica,Arial,sans-serif"; @@ -98,7 +96,6 @@ L.StreetLabels = L.LabelTextCollision textWidth, textHeight)); if (this.options.collisionFlg) { - for (var index in this._textList) { var pointBounds = this._textList[index]; if (pointBounds.intersects(bounds)) { @@ -184,7 +181,7 @@ L.StreetLabels = L.LabelTextCollision return polyline; }, - _getDynamicFontSize: function () { + _getDynamicFontSize: function (layer) { return parseInt(this._map.getZoom()); }, -- cgit v1.2.3