Skip to content

Commit a15689d

Browse files
feat: Turtle.get/set_ID ( Fixes #84 )
1 parent 5bd9662 commit a15689d

File tree

6 files changed

+10
-5
lines changed

6 files changed

+10
-5
lines changed

Types/Turtle/get_ID.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
if ($this.'.ID') { return $this.'.ID'}
2+
return 'turtle'

Types/Turtle/get_Mask.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
$segments = @(
22
"<svg xmlns='http://www.w3.org/2000/svg' width='0%' height='0%'>"
33
"<defs>"
4-
"<mask id='turtle-mask'>"
4+
"<mask id='$($this.Id)-mask'>"
55
$this.Symbol.OuterXml -replace '\<\?[^\>]+\>'
66
"</mask>"
77
"</defs>"

Types/Turtle/get_PathElement.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@(
2-
"<path id='turtle-path' d='$($this.PathData)' stroke='$(
2+
"<path id='$($this.id)-path' d='$($this.PathData)' stroke='$(
33
if ($this.Stroke) { $this.Stroke } else { 'currentColor' }
44
)' stroke-width='$(
55
if ($this.StrokeWidth) { $this.StrokeWidth } else { '0.1%' }

Types/Turtle/get_PatternMask.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
$segments = @(
22
"<svg xmlns='http://www.w3.org/2000/svg' width='0%' height='0%'>"
33
"<defs>"
4-
"<mask id='turtle-mask'>"
4+
"<mask id='$($this.ID)-mask'>"
55
$this.Pattern.OuterXml -replace '\<\?[^\>]+\>'
66
"</mask>"
77
"</defs>"

Types/Turtle/get_Symbol.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ param()
1515

1616
@(
1717
"<svg xmlns='http://www.w3.org/2000/svg' width='100%' height='100%' transform-origin='50% 50%'>"
18-
"<symbol id='turtle-symbol' viewBox='$($this.ViewBox)' transform-origin='50% 50%'>"
18+
"<symbol id='$($this.ID)-symbol' viewBox='$($this.ViewBox)' transform-origin='50% 50%'>"
1919
$this.PathElement.OuterXml
2020
"</symbol>"
2121
$(
2222
if ($this.BackgroundColor) {
2323
"<rect width='10000%' height='10000%' x='-5000%' y='-5000%' fill='$($this.BackgroundColor)' transform-origin='50% 50%' />"
2424
}
2525
)
26-
"<use href='#turtle-symbol' width='100%' height='100%' transform-origin='50% 50%' />"
26+
"<use href='#$($this.ID)-symbol' width='100%' height='100%' transform-origin='50% 50%' />"
2727
"</svg>"
2828
) -join '' -as [xml]

Types/Turtle/set_ID.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
param([string]$Value)
2+
3+
$this | Add-Member NoteProperty '.ID' $Value -Force

0 commit comments

Comments
 (0)