Skip to content

Commit c7c1860

Browse files
Merge pull request #340 from ninmonkey/fix-forward-returns-NaN
fix: `Turtle.js.pathData` returns `NaN` paths ( fixes: #339, fixes: #336, fixes: #337, fixes: #338 )
2 parents 7728acc + bab43ec commit c7c1860

File tree

5 files changed

+22
-13
lines changed

5 files changed

+22
-13
lines changed

Turtle.types.ps1xml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8694,10 +8694,6 @@ foreach ($javaScriptProperty in $this.psobject.properties | Sort-Object Name) {
86948694
)
86958695
}</Value>
86968696
</NoteProperty>
8697-
<NoteProperty>
8698-
<Name>get_heading.js</Name>
8699-
<Value>heading: 0.0</Value>
8700-
</NoteProperty>
87018697
<NoteProperty>
87028698
<Name>go.js</Name>
87038699
<Value>function go() {
@@ -8712,6 +8708,17 @@ foreach ($javaScriptProperty in $this.psobject.properties | Sort-Object Name) {
87128708
<Name>goto.js</Name>
87138709
<Value>function goto(x,y) { return this.step(x - this.x, y - this.y) }</Value>
87148710
</NoteProperty>
8711+
<NoteProperty>
8712+
<Name>heading.js</Name>
8713+
<Value>function get_heading() {
8714+
const _ = this
8715+
if ( _['#heading'] === undefined ) {
8716+
_['#heading'] = 0.0
8717+
}
8718+
return _['#heading']
8719+
}
8720+
</Value>
8721+
</NoteProperty>
87158722
<NoteProperty>
87168723
<Name>height.js</Name>
87178724
<Value>height: 0.0</Value>
@@ -8785,7 +8792,7 @@ foreach ($javaScriptProperty in $this.psobject.properties | Sort-Object Name) {
87858792
</NoteProperty>
87868793
<NoteProperty>
87878794
<Name>pathData.js</Name>
8788-
<Value>function get_pathData() {
8795+
<Value>function pathData() {
87898796
let startX = 0;
87908797
let startY = 0;
87918798
if (!this.min) { this.min = { x: 0.0, y: 0.0}}
@@ -8844,14 +8851,12 @@ foreach ($javaScriptProperty in $this.psobject.properties | Sort-Object Name) {
88448851
<NoteProperty>
88458852
<Name>set_heading.js</Name>
88468853
<Value>function set_heading(value) {
8847-
let _ = this
8854+
const _ = this
88488855
try {
88498856
_['#heading'] = new Number(value)
88508857
} catch {
8851-
88528858
_['#heading'] = 0.0
88538859
}
8854-
88558860
return _
88568861
}</Value>
88578862
</NoteProperty>

Types/Turtle.js/get_heading.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

Types/Turtle.js/heading.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
function get_heading() {
2+
const _ = this
3+
if ( _['#heading'] === undefined ) {
4+
_['#heading'] = 0.0
5+
}
6+
return _['#heading']
7+
}

Types/Turtle.js/pathData.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function get_pathData() {
1+
function pathData() {
22
let startX = 0;
33
let startY = 0;
44
if (!this.min) { this.min = { x: 0.0, y: 0.0}}

Types/Turtle.js/set_heading.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
function set_heading(value) {
2-
let _ = this
2+
const _ = this
33
try {
44
_['#heading'] = new Number(value)
55
} catch {
6-
76
_['#heading'] = 0.0
87
}
9-
108
return _
119
}

0 commit comments

Comments
 (0)