File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -88,8 +88,10 @@ export function getSvgFromGraphicsObject(
8888 graphics : GraphicsObject ,
8989 {
9090 includeTextLabels = false ,
91+ backgroundColor,
9192 } : {
9293 includeTextLabels ?: boolean
94+ backgroundColor ?: string
9395 } = { } ,
9496) : string {
9597 const bounds = getBounds ( graphics )
@@ -105,6 +107,20 @@ export function getSvgFromGraphicsObject(
105107 xmlns : "http://www.w3.org/2000/svg" ,
106108 } ,
107109 children : [
110+ // Background rectangle (optional)
111+ ...( backgroundColor
112+ ? [
113+ {
114+ name : "rect" ,
115+ type : "element" ,
116+ attributes : {
117+ width : "100%" ,
118+ height : "100%" ,
119+ fill : backgroundColor ,
120+ } ,
121+ } ,
122+ ]
123+ : [ ] ) ,
108124 // Points
109125 ...( graphics . points || [ ] ) . map ( ( point ) => {
110126 const projected = projectPoint ( point , matrix )
You can’t perform that action at this time.
0 commit comments