File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010. LINK
1111 https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/marker
1212#>
13+ [OutputType ([xml ])]
1314param ()
1415
1516# The default settings for markers
Original file line number Diff line number Diff line change 3434. LINK
3535 https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/mask
3636#>
37+ [OutputType ([xml ])]
3738param ()
3839
3940$keyPattern = ' ^mask/'
Original file line number Diff line number Diff line change 55 Gets the Path Element of a Turtle.
66
77 This contains the path of the Turtle's motion.
8+ . EXAMPLE
9+ turtle forward 42 rotate 90 forward 42 pathElement
810#>
9-
11+ [OutputType ([xml ])]
12+ param ()
1013# Set our core attributes
1114$coreAttributes = [Ordered ]@ {
1215 id = " $ ( $this.id ) -path"
@@ -26,12 +29,20 @@ foreach ($pathAttributeName in $this.PathAttribute.Keys) {
2629 $coreAttributes [$pathAttributeName ] = $ ($this.PathAttribute [$pathAttributeName ])
2730}
2831
29- @ (
32+ # Path attributes can be defined within .SVGAttribute or .Attribute
33+ foreach ($attributeCollectionName in ' SVGAttribute' , ' Attribute' ) {
34+ $attributeCollection = $this .$attributeCollectionName
35+ foreach ($attributeName in $attributeCollection.Keys -match ' ^path/' ) {
36+ $coreAttributes [$attributeName -replace ' ^path/' ] = $attributeCollection [$attributeName ]
37+ }
38+ }
39+
40+ [xml ]@ (
3041" <path$ (
3142 foreach ($attributeName in $coreAttributes.Keys ) {
3243 " $attributeName ='$ ( $coreAttributes [$attributeName ]) '"
3344 }
3445) >"
3546if ($this.PathAnimation ) {$this.PathAnimation }
3647" </path>"
37- ) -as [ xml ]
48+ )
Original file line number Diff line number Diff line change 3737. LINK
3838 https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/mask
3939#>
40+ [OutputType ([xml ])]
4041param ()
4142$keyPattern = ' ^pattern-?mask/'
4243$defaultId = " $ ( $this.Id ) -pattern-mask"
@@ -65,4 +66,4 @@ $segments = @(
6566" </mask>"
6667)
6768# join them and cast to XML.
68- [xml ]( $segments -join ' ' )
69+ [xml ]$segments
Original file line number Diff line number Diff line change 44. DESCRIPTION
55 Gets this turtle and any nested turtles as a single Scalable Vector Graphic.
66#>
7+ [OutputType ([xml ])]
78param ()
8- @ (
99
1010$svgAttributes = [Ordered ]@ {
1111 xmlns = ' http://www.w3.org/2000/svg'
@@ -35,6 +35,7 @@ foreach ($key in $this.SVGAttribute.Keys) {
3535 $svgAttributes [$key ] = $this.SVGAttribute [$key ]
3636}
3737
38+ $svgElement = @ (
3839" <svg $ ( @ (foreach ($attributeName in $svgAttributes.Keys ) {
3940 if ($attributeName -match ' /' ) { continue }
4041 " $attributeName ='$ ( $svgAttributes [$attributeName ]) '"
@@ -75,7 +76,7 @@ foreach ($key in $this.SVGAttribute.Keys) {
7576 }
7677
7778 # Declare any SVG animations
78- if ($this.SVGAnimation ) {$this.SVGAnimation }
79+ if ($this.SVGAnimation ) {$this.SVGAnimation }
7980 if ($this.BackgroundColor ) {
8081 " <rect width='10000%' height='10000%' x='-5000%' y='-5000%' fill='$ ( $this.BackgroundColor ) ' transform-origin='50% 50%' />"
8182 }
@@ -113,4 +114,5 @@ foreach ($key in $this.SVGAttribute.Keys) {
113114 " </a>"
114115 }
115116" </svg>"
116- ) -join ' ' -as [xml ]
117+ )
118+ [xml ]$svgElement
Original file line number Diff line number Diff line change 1111 Move-Turtle Flower |
1212 Select-Object -ExpandProperty Symbol
1313#>
14+ [OutputType ([xml ])]
1415param ()
1516
16- @ (
17- " <svg xmlns='http://www.w3.org/2000/svg' width='100%' height='100%' transform-origin='50% 50%'>"
18- " <symbol id='$ ( $this.ID ) -symbol' viewBox='$ ( $this.ViewBox ) ' transform-origin='50% 50%'>"
19- $ ($this.SVG.OuterXml )
20- " </symbol>"
21- " <use href='#$ ( $this.ID ) -symbol' width='100%' height='100%' transform-origin='50% 50%' />"
22- " </svg>"
23- ) -join ' ' -as [ xml ]
17+ [ xml ] @ (
18+ " <svg xmlns='http://www.w3.org/2000/svg' width='100%' height='100%' transform-origin='50% 50%'>"
19+ " <symbol id='$ ( $this.ID ) -symbol' viewBox='$ ( $this.ViewBox ) ' transform-origin='50% 50%'>"
20+ $ ($this.SVG.OuterXml )
21+ " </symbol>"
22+ " <use href='#$ ( $this.ID ) -symbol' width='100%' height='100%' transform-origin='50% 50%' />"
23+ " </svg>"
24+ )
Original file line number Diff line number Diff line change 1212. EXAMPLE
1313 turtle text "hello world" textElement
1414#>
15-
15+ [OutputType ([xml ])]
16+ param ()
1617
1718if (-not $this.Text ) { return }
1819
You can’t perform that action at this time.
0 commit comments