Skip to content

Commit a6bf3bb

Browse files
StartAutomatingStartAutomating
authored andcommitted
feat: Turtle.get/set_Style(s) ( Fixes PoshWeb#254 )
1 parent 4b17f6d commit a6bf3bb

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

Turtle.types.ps1xml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@
163163
<Name>SierpińskiTriangle</Name>
164164
<ReferencedMemberName>SierpinskiTriangle</ReferencedMemberName>
165165
</AliasProperty>
166+
<AliasProperty>
167+
<Name>Styles</Name>
168+
<ReferencedMemberName>Style</ReferencedMemberName>
169+
</AliasProperty>
166170
<AliasProperty>
167171
<Name>up</Name>
168172
<ReferencedMemberName>PenUp</ReferencedMemberName>
@@ -5177,6 +5181,49 @@ $this | Add-Member -MemberType NoteProperty -Force -Name '.Stroke' -Value $value
51775181
$this | Add-Member -MemberType NoteProperty -Force -Name '.StrokeWidth' -Value $value
51785182
</SetScriptBlock>
51795183
</ScriptProperty>
5184+
<ScriptProperty>
5185+
<Name>Style</Name>
5186+
<GetScriptBlock>
5187+
&lt;#
5188+
.SYNOPSIS
5189+
Gets a Turtle's Style
5190+
.DESCRIPTION
5191+
Gets any CSS styles associated with the Turtle.
5192+
5193+
These styles will be declared in a `&lt;style&gt;` element, just beneath a Turtle's `&lt;svg&gt;`
5194+
.EXAMPLE
5195+
turtle style '.myClass { color: #4488ff}' style
5196+
#&gt;
5197+
param()
5198+
5199+
if (-not $this.'.style') {
5200+
$this | Add-Member NoteProperty '.style' @() -Force
5201+
}
5202+
5203+
return $this.'.style'
5204+
</GetScriptBlock>
5205+
<SetScriptBlock>
5206+
&lt;#
5207+
.SYNOPSIS
5208+
Sets a Turtle's Style
5209+
.DESCRIPTION
5210+
Sets any CSS styles associated with the Turtle.
5211+
5212+
These styles will be declared in a `&lt;style&gt;` element, just beneath a Turtle's `&lt;svg&gt;`
5213+
.EXAMPLE
5214+
turtle style '.myClass { color: #4488ff}' style
5215+
#&gt;
5216+
param(
5217+
[PSObject]
5218+
$Style
5219+
)
5220+
5221+
$styleList = $this.Style
5222+
$styleList += $style
5223+
$this | Add-Member NoteProperty '.style' $styleList -Force
5224+
5225+
</SetScriptBlock>
5226+
</ScriptProperty>
51805227
<ScriptProperty>
51815228
<Name>SVG</Name>
51825229
<GetScriptBlock>

0 commit comments

Comments
 (0)