Merge pull request #13941 from MoonE/kml-default-icon-anchor

Fix KML default icon anchor with https icon url
This commit is contained in:
MoonE
2022-08-06 21:09:01 +02:00
committed by GitHub

View File

@@ -1023,7 +1023,7 @@ function createFeatureStyleFunction(
name = /** @type {string} */ (feature.get('name')); name = /** @type {string} */ (feature.get('name'));
drawName = drawName && !!name; drawName = drawName && !!name;
// convert any html character codes // convert any html character codes
if (drawName && name.search(/&[^&]+;/) > -1) { if (drawName && /&[^&]+;/.test(name)) {
if (!TEXTAREA) { if (!TEXTAREA) {
TEXTAREA = document.createElement('textarea'); TEXTAREA = document.createElement('textarea');
} }
@@ -1274,17 +1274,17 @@ function iconStyleParser(node, objectStack) {
anchorXUnits = hotSpot.xunits; anchorXUnits = hotSpot.xunits;
anchorYUnits = hotSpot.yunits; anchorYUnits = hotSpot.yunits;
anchorOrigin = hotSpot.origin; 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 // Google hotspots from https://kml4earth.appspot.com/icons.html#notes
if (/pushpin/.test(src)) { if (src.includes('pushpin')) {
anchor = DEFAULT_IMAGE_STYLE_ANCHOR; anchor = DEFAULT_IMAGE_STYLE_ANCHOR;
anchorXUnits = DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS; anchorXUnits = DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS;
anchorYUnits = DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS; anchorYUnits = DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS;
} else if (/arrow-reverse/.test(src)) { } else if (src.includes('arrow-reverse')) {
anchor = [54, 42]; anchor = [54, 42];
anchorXUnits = DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS; anchorXUnits = DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS;
anchorYUnits = DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS; anchorYUnits = DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS;
} else if (/paddle/.test(src)) { } else if (src.includes('paddle')) {
anchor = [32, 1]; anchor = [32, 1];
anchorXUnits = DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS; anchorXUnits = DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS;
anchorYUnits = DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS; anchorYUnits = DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS;