Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/getSvgFromGraphicsObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export function getSvgFromGraphicsObject(graphics: GraphicsObject): string {
.join(" "),
fill: "none",
stroke: line.strokeColor || "black",
"stroke-width": (line.strokeWidth || 1).toString(),
"stroke-width": ((line.strokeWidth || 1) / Math.abs(matrix.a) * DEFAULT_SVG_SIZE / 100).toString(),
},
})),
// Rectangles
Expand Down
4 changes: 2 additions & 2 deletions tests/__snapshots__/lines.snap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/__snapshots__/renderer-graphics.snap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions tests/getSvgFromGraphicsObject.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,8 @@ describe("getSvgFromGraphicsObject", () => {
expect(svg).toBeString()
expect(svg).toContain("<polyline")
// Test custom stroke properties
expect(svg).toContain('stroke-width="2"')
expect(svg).toContain('stroke="blue"')
// Test default values
expect(svg).toContain('stroke-width="1"')
// Don't test for exact stroke-width values as they're scaled based on the matrix
expect(svg).toContain('stroke="black"')
expect(svg).toMatchSvgSnapshot(import.meta.path, "lines")
})
Expand Down