From b0adb91c69941e98ed54d9f10c651115cedfebfb Mon Sep 17 00:00:00 2001 From: Markus Koch Date: Tue, 5 May 2020 19:44:54 +0200 Subject: Make street label collision flag a function --- htdocs/leafletjs/Leaflet.streetlabels.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'htdocs/leafletjs/Leaflet.streetlabels.js') diff --git a/htdocs/leafletjs/Leaflet.streetlabels.js b/htdocs/leafletjs/Leaflet.streetlabels.js index 5342bea..864f791 100644 --- a/htdocs/leafletjs/Leaflet.streetlabels.js +++ b/htdocs/leafletjs/Leaflet.streetlabels.js @@ -94,7 +94,7 @@ L.StreetLabels = L.LabelTextCollision L.point(p.x + offsetX, p.y + offsetY), L.point( textWidth, textHeight)); - if (this.options.collisionFlg) { + if (this._getCollisionFlag(layer)) { for (var index in this._textList) { var pointBounds = this._textList[index]; if (pointBounds.intersects(bounds)) { @@ -105,7 +105,6 @@ L.StreetLabels = L.LabelTextCollision this._textList.push(bounds); - ctx.fillStyle = this.options.fontStyle.fillStyle; ctx.strokeStyle = this.options.fontStyle.strokeStyle; @@ -143,6 +142,10 @@ L.StreetLabels = L.LabelTextCollision } }, + _getCollisionFlag: function (layer) { + return this.options.collisionFlg; + }, + /*** * Returns the bearing in degrees clockwise from north (0 degrees) from the first L.LatLng to the second, at the first LatLng -- cgit v1.2.3