Skip to content

Commit 1b52bf8

Browse files
author
James Brundage
committed
Merge branch 'new-turtle' of https://github.com/PowerShellWeb/Turtle into new-turtle
2 parents 579899e + 8970257 commit 1b52bf8

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

Turtle.types.ps1xml

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,8 @@ return ([pscustomobject]@{ X = 0; Y = 0 })
242242
<GetScriptBlock>
243243
param()
244244
$segments = @(
245-
$viewX = [Math]::Max($this.Maximum.X, $this.Minimum.X * -1)
246-
$viewY = [Math]::Max($this.Maximum.Y, $this.Minimum.Y * -1)
245+
$viewX = $this.Maximum.X + ($this.Minimum.X * -1)
246+
$viewY = $this.Maximum.Y + ($this.Minimum.Y * -1)
247247
"&lt;svg xmlns='http://www.w3.org/2000/svg' width='100%' height='100%'&gt;"
248248
"&lt;defs&gt;"
249249
"&lt;pattern id='turtle-pattern' patternUnits='userSpaceOnUse' width='$viewX' height='$viewY' transform-origin='50% 50%'$(
@@ -258,6 +258,8 @@ $viewY = [Math]::Max($this.Maximum.Y, $this.Minimum.Y * -1)
258258
$(if ($this.PatternAnimation) { $this.PatternAnimation })
259259
"&lt;path id='turtle-path' d='$($this.PathData)' stroke='$(
260260
if ($this.Stroke) { $this.Stroke } else { 'black' }
261+
)' stroke-width='$(
262+
if ($this.StrokeWidth) { $this.StrokeWidth } else { '0.1%' }
261263
)' fill='transparent'/&gt;"
262264
"&lt;/pattern&gt;"
263265
"&lt;/defs&gt;"
@@ -380,18 +382,18 @@ $this | Add-Member -MemberType NoteProperty -Force -Name '.Stroke' -Value $value
380382
</SetScriptBlock>
381383
</ScriptProperty>
382384
<ScriptProperty>
383-
<Name>StrokeThickness</Name>
385+
<Name>StrokeWidth</Name>
384386
<GetScriptBlock>
385-
if ($this.'.StrokeThickness') {
386-
return $this.'.StrokeThickness'
387+
if ($this.'.StrokeWidth') {
388+
return $this.'.StrokeWidth'
387389
} else {
388390
return '0.1%'
389391
}
390392
</GetScriptBlock>
391393
<SetScriptBlock>
392394
param([string]$value)
393395

394-
$this | Add-Member -MemberType NoteProperty -Force -Name '.StrokeThickness' -Value $value
396+
$this | Add-Member -MemberType NoteProperty -Force -Name '.StrokeWidth' -Value $value
395397
</SetScriptBlock>
396398
</ScriptProperty>
397399
<ScriptProperty>
@@ -400,14 +402,14 @@ $this | Add-Member -MemberType NoteProperty -Force -Name '.StrokeThickness' -Val
400402
param()
401403
@(
402404

403-
$viewX = [Math]::Max($this.Maximum.X, $this.Minimum.X * -1)
404-
$viewY = [Math]::Max($this.Maximum.Y, $this.Minimum.Y * -1)
405+
$viewX = $this.Maximum.X + ($this.Minimum.X * -1)
406+
$viewY = $this.Maximum.Y + ($this.Minimum.Y * -1)
405407

406408
"&lt;svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 $viewX $viewY' transform-origin='50% 50%' width='100%' height='100%'&gt;"
407409
"&lt;path id='turtle-path' transform-origin='50% 50%' d='$($this.PathData)' stroke='$(
408410
if ($this.Stroke) { $this.Stroke } else { '#4488ff' }
409-
)' stroke-thickness='$(
410-
if ($this.StrokeThickness) { $this.StrokeThickness } else { '0.1%' }
411+
)' stroke-width='$(
412+
if ($this.StrokeWidth) { $this.StrokeWidth } else { '0.1%' }
411413
)' fill='transparent'/&gt;"
412414
"&lt;/svg&gt;"
413415
) -join '' -as [xml]
@@ -418,13 +420,16 @@ $viewY = [Math]::Max($this.Maximum.Y, $this.Minimum.Y * -1)
418420
<GetScriptBlock>
419421
param()
420422

421-
@(
422-
$viewX = [Math]::Max($this.Maximum.X, $this.Minimum.X * -1)
423-
$viewY = [Math]::Max($this.Maximum.Y, $this.Minimum.Y * -1)
423+
$viewX = $this.Maximum.X + ($this.Minimum.X * -1)
424+
$viewY = $this.Maximum.Y + ($this.Minimum.Y * -1)
425+
426+
@(
424427
"&lt;svg xmlns='http://www.w3.org/2000/svg' width='100%' height='100%'&gt;"
425428
"&lt;symbol id='turtle-symbol' viewBox='0 0 $viewX $viewY' transform-origin='50% 50%'&gt;"
426429
"&lt;path id='turtle-path' transform-origin='50% 50%' d='$($this.PathData)' stroke='$(
427430
if ($this.Stroke) { $this.Stroke } else { 'black' }
431+
)' stroke-width='$(
432+
if ($this.StrokeWidth) { $this.StrokeWidth } else { '0.1%' }
428433
)' fill='transparent'/&gt;"
429434
"&lt;/symbol&gt;"
430435
"&lt;use href='#turtle-symbol' width='100%' height='100%' /&gt;"

0 commit comments

Comments
 (0)