Skip to content

Commit 38fc5b3

Browse files
feat: Turtle.ClosePath ( Fixes PoshWeb#277 )
1 parent 1ee5bc5 commit 38fc5b3

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

Types/Turtle/ClosePath.ps1

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<#
2+
.SYNOPSIS
3+
Closes a path
4+
.DESCRIPTION
5+
Closes a path and resets the position to the last move command (Start or Teleport)
6+
.EXAMPLE
7+
turtle forward 42 rotate 90 forward 42 closePath rotate 90 forward 42 rotate 90 forward 42 closePath show
8+
#>
9+
param()
10+
$this.Steps.Add("z")
11+
$history =$this.History
12+
if ($history) {
13+
$change = $this.History[-1]
14+
$this.Position = $change.Delta.X, $change.Delta.Y
15+
} else {
16+
$this.Position = 0, 0
17+
}
18+
19+

0 commit comments

Comments
 (0)