Skip to content

Commit 117da3c

Browse files
authored
Constant Heading Fix (#30)
Fixed a bug
1 parent 4e95833 commit 117da3c

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎src/lib/components/HeadingControls.svelte‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@
77

88
<select
99
bind:value={endPoint.heading}
10+
on:change={() => {
11+
// Initialize missing properties based on the selected heading type
12+
if (endPoint.heading === "constant" && endPoint.degrees === undefined) {
13+
endPoint.degrees = 0;
14+
} else if (endPoint.heading === "linear") {
15+
if (endPoint.startDeg === undefined) endPoint.startDeg = 0;
16+
if (endPoint.endDeg === undefined) endPoint.endDeg = 0;
17+
} else if (endPoint.heading === "tangential") {
18+
if (endPoint.reverse === undefined) endPoint.reverse = false;
19+
}
20+
dispatch("change");
21+
}}
1022
class=" rounded-md bg-neutral-100 dark:bg-neutral-950 dark:border-neutral-700 border-[0.5px] focus:outline-none w-28 text-sm"
1123
title="The heading style of the robot.
1224
With constant heading, the robot maintains the same heading throughout the line.

0 commit comments

Comments
 (0)