Skip to content

Commit 6a332e8

Browse files
feat: Turtle.VerticalLine becomes v ( Fixes PoshWeb#281 )
1 parent 34d7401 commit 6a332e8

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

Types/Turtle/Alias.psd1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
c = 'CubicBezierCurve'
66
l = 'Step'
77
h = 'HorizontalLine'
8-
s = 'BezierCurve'
98
q = 'QuadraticBezierCurve'
9+
s = 'BezierCurve'
10+
v = 'VerticalLine'
1011

1112
# Shorter forms:
1213
Pie = 'PieGraph'

Types/Turtle/VerticalLine.ps1

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,22 @@
55
Draws a vertical line.
66
77
The heading will not be changed.
8+
.EXAMPLE
9+
turtle VerticalLine 42
10+
.EXAMPLE
11+
turtle VerticalLine 42 pathdata
812
#>
913
param(
14+
# The length of the line.
1015
[double]
1116
$Distance
1217
)
1318

14-
$this.GoTo($this.Position.X, $this.Position.Y + $Distance)
19+
$instruction =
20+
if ($this.IsPenDown) {
21+
"v $Distance"
22+
} else {
23+
"m 0 $($this.Position.Y + $Distance)"
24+
}
25+
$this.Position = 0, $Distance
26+
$this.Steps.Add($instruction)

0 commit comments

Comments
 (0)