File tree Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -623,11 +623,26 @@ export class StyleUtils {
623623 }
624624 if ( type === "POINT" ) {
625625 if ( src ) {
626- newImage = new ol . style . Icon ( {
627- src : src ,
628- scale : scale ,
629- anchor : anchor
630- } ) ;
626+ if ( / .+ ( \. s v g $ ) / . test ( src ) ) {
627+ if ( ! this . svgDiv ) {
628+ this . svgDiv = document . createElement ( 'div' ) ;
629+ document . body . appendChild ( this . svgDiv ) ;
630+ }
631+ this . getCanvasFromSVG ( src , this . svgDiv , ( canvas ) => {
632+ newImage = new ol . style . Icon ( {
633+ img : canvas ,
634+ scale : radius / canvas . width ,
635+ imgSize : [ canvas . width , canvas . height ] ,
636+ anchor : [ 0.5 , 0.5 ]
637+ } )
638+ } )
639+ } else {
640+ newImage = new ol . style . Icon ( {
641+ src : src ,
642+ scale : scale ,
643+ anchor : anchor
644+ } ) ;
645+ }
631646 } else {
632647 newImage = new ol . style . Circle ( {
633648 radius : radius ,
You can’t perform that action at this time.
0 commit comments