From f2e82ba1e4d023413b9c75295ea12a14aeef0d4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Kr=C3=B6g?= Date: Sat, 6 Aug 2022 11:05:03 +0200 Subject: [PATCH] Fix default icon anchor with https icon url --- src/ol/format/KML.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ol/format/KML.js b/src/ol/format/KML.js index 5ba30be414..d7d8175fdc 100644 --- a/src/ol/format/KML.js +++ b/src/ol/format/KML.js @@ -1023,7 +1023,7 @@ function createFeatureStyleFunction( name = /** @type {string} */ (feature.get('name')); drawName = drawName && !!name; // convert any html character codes - if (drawName && name.search(/&[^&]+;/) > -1) { + if (drawName && /&[^&]+;/.test(name)) { if (!TEXTAREA) { TEXTAREA = document.createElement('textarea'); } @@ -1274,17 +1274,17 @@ function iconStyleParser(node, objectStack) { anchorXUnits = hotSpot.xunits; anchorYUnits = hotSpot.yunits; anchorOrigin = hotSpot.origin; - } else if (/^http:\/\/maps\.(?:google|gstatic)\.com\//.test(src)) { + } else if (/^https?:\/\/maps\.(?:google|gstatic)\.com\//.test(src)) { // Google hotspots from https://kml4earth.appspot.com/icons.html#notes - if (/pushpin/.test(src)) { + if (src.includes('pushpin')) { anchor = DEFAULT_IMAGE_STYLE_ANCHOR; anchorXUnits = DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS; anchorYUnits = DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS; - } else if (/arrow-reverse/.test(src)) { + } else if (src.includes('arrow-reverse')) { anchor = [54, 42]; anchorXUnits = DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS; anchorYUnits = DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS; - } else if (/paddle/.test(src)) { + } else if (src.includes('paddle')) { anchor = [32, 1]; anchorXUnits = DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS; anchorYUnits = DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS;