@@ -335,7 +335,9 @@ class Visualizer {
335335
336336 // Embed the image centered at position (x, y)
337337 const image = document . createElementNS ( ns , 'image' ) ;
338- image . setAttribute ( 'href' , `/assets/${ imageName } ` ) ;
338+ const imageHref = new URL ( `assets/${ imageName } ` , document . baseURI ) . toString ( ) ;
339+ image . setAttribute ( 'href' , imageHref ) ;
340+ image . setAttributeNS ( 'http://www.w3.org/1999/xlink' , 'href' , imageHref ) ;
339341 image . setAttribute ( 'x' , x - imgWidth / 2 ) ;
340342 image . setAttribute ( 'y' , y - imgHeight / 2 ) ;
341343 image . setAttribute ( 'width' , imgWidth ) ;
@@ -1062,7 +1064,9 @@ class Visualizer {
10621064 const imgHeight = 100 ;
10631065
10641066 const image = document . createElementNS ( ns , 'image' ) ;
1065- image . setAttributeNS ( 'http://www.w3.org/1999/xlink' , 'href' , `/assets/${ imageName } ` ) ;
1067+ const imageHref = new URL ( `assets/${ imageName } ` , document . baseURI ) . toString ( ) ;
1068+ image . setAttribute ( 'href' , imageHref ) ;
1069+ image . setAttributeNS ( 'http://www.w3.org/1999/xlink' , 'href' , imageHref ) ;
10661070 image . setAttribute ( 'x' , x - imgWidth / 2 - 29 ) ;
10671071 image . setAttribute ( 'y' , y - imgHeight / 2 ) ;
10681072 image . setAttribute ( 'width' , imgWidth ) ;
0 commit comments