From 719496adf71fcf9432ad00c0f2046b856bee5627 Mon Sep 17 00:00:00 2001 From: PhilippeL Date: Fri, 27 Mar 2020 09:30:37 -0400 Subject: [PATCH] fix(query): fix Firefox and IE svg change bug --- .../src/lib/overlay/shared/overlay.utils.ts | 53 +++++++++++++------ 1 file changed, 37 insertions(+), 16 deletions(-) diff --git a/packages/geo/src/lib/overlay/shared/overlay.utils.ts b/packages/geo/src/lib/overlay/shared/overlay.utils.ts index f435dd2093..463a5f8ae4 100644 --- a/packages/geo/src/lib/overlay/shared/overlay.utils.ts +++ b/packages/geo/src/lib/overlay/shared/overlay.utils.ts @@ -109,6 +109,9 @@ export function createOverlayMarkerStyle( let svgIconColor; let svgOutlineColor; let svg; + + const isIE = /msie\s|trident\/|edge\//i.test(window.navigator.userAgent); // To fix IE11 svg bug (temporarly) + switch (color) { case 'blue': svgIconColor = '"rgb(0,161,222)"'; @@ -150,26 +153,44 @@ export function createOverlayMarkerStyle( svgOutlineColor = 'rgb(0,128,0)'; break; } - svg = '' + + svg = '' + '' + ''; } - return new olstyle.Style({ - image: new olstyle.Icon({ - src: svg ? 'data:image/svg+xml;utf8,' + svg : './assets/igo2/geo/icons/place_' + iconColor + '_36px.svg', - opacity, - imgSize: [36, 36], // for ie - anchor: [0.5, 0.92] - }), - text: new olstyle.Text({ - text, - font: '12px Calibri,sans-serif', - fill: new olstyle.Fill({ color: '#000' }), - stroke: new olstyle.Stroke({ color: '#fff', width: 3 }), - overflow: true - }) - }); + if (!isIE) { + return new olstyle.Style({ + image: new olstyle.Icon({ + src: svg ? 'data:image/svg+xml;utf8,' + svg : './assets/igo2/geo/icons/place_' + iconColor + '_36px.svg', + opacity, + imgSize: [36, 36], // for ie + anchor: [0.5, 0.92] + }), + text: new olstyle.Text({ + text, + font: '12px Calibri,sans-serif', + fill: new olstyle.Fill({ color: '#000' }), + stroke: new olstyle.Stroke({ color: '#fff', width: 3 }), + overflow: true + }) + }); + } else { + return new olstyle.Style({ + image: new olstyle.Icon({ + src: './assets/igo2/geo/icons/place_' + iconColor + '_36px.svg', + opacity, + imgSize: [36, 36], // for ie + anchor: [0.5, 0.92] + }), + text: new olstyle.Text({ + text, + font: '12px Calibri,sans-serif', + fill: new olstyle.Fill({ color: '#000' }), + stroke: new olstyle.Stroke({ color: '#fff', width: 3 }), + overflow: true + }) + }); + } } function createBufferStyle(