Skip to content

Commit ebe9773

Browse files
author
James Brundage
committed
feat: Turtle.get_SVG ( Fixes #17 )
1 parent 3b058cd commit ebe9773

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Types/Turtle/get_SVG.ps1

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
param()
2+
@(
3+
4+
$viewX = [Math]::Max($this.Maximum.X, $this.Minimum.X * -1)
5+
$viewY = [Math]::Max($this.Maximum.Y, $this.Minimum.Y * -1)
6+
7+
"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 $viewX $viewY' transform-origin='50% 50%' width='100%' height='100%'>"
8+
"<path id='turtle-path' transform-origin='50% 50%' d='$($this.PathData)' stroke='$(
9+
if ($this.Stroke) { $this.Stroke } else { '#4488ff' }
10+
)' stroke-thickness='$(
11+
if ($this.StrokeThickness) { $this.StrokeThickness } else { '0.1%' }
12+
)' fill='transparent'/>"
13+
"</svg>"
14+
) -join '' -as [xml]

0 commit comments

Comments
 (0)