File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import type {
1111 CenterViewbox ,
1212 TransformOptions ,
1313} from "./types"
14+ import { defaultColors } from "site/components/InteractiveGraphics/defaultColors"
1415
1516/**
1617 * Computes a transformation matrix based on a provided viewbox
@@ -215,7 +216,7 @@ export function drawGraphicsToCanvas(
215216
216217 // Draw lines
217218 if ( graphics . lines && graphics . lines . length > 0 ) {
218- graphics . lines . forEach ( ( line ) => {
219+ graphics . lines . forEach ( ( line , lineIndex ) => {
219220 if ( line . points . length === 0 ) return
220221
221222 ctx . beginPath ( )
@@ -228,7 +229,8 @@ export function drawGraphicsToCanvas(
228229 ctx . lineTo ( projected . x , projected . y )
229230 }
230231
231- ctx . strokeStyle = line . strokeColor || "black"
232+ ctx . strokeStyle =
233+ line . strokeColor || defaultColors [ lineIndex % defaultColors . length ]
232234 if ( line . strokeWidth ) {
233235 ctx . lineWidth = line . strokeWidth * matrix . a
234236 } else {
You can’t perform that action at this time.
0 commit comments