Add UI for closing the sketch loop (#87)

This commit is contained in:
Kurt Hutten
2023-04-01 20:38:31 +11:00
committed by GitHub
parent 0593afc4ff
commit 61533fb306
6 changed files with 87 additions and 19 deletions

View File

@ -1479,12 +1479,14 @@ function addTagWithTo(
}
}
export const closee: InternalFn = (
{ sourceRange, programMemory },
export const close: InternalFn = (
{ sourceRange },
sketchGroup: SketchGroup
): SketchGroup => {
const from = getCoordsFromPaths(sketchGroup, sketchGroup.value.length - 1)
const to = getCoordsFromPaths(sketchGroup, 0)
const to = sketchGroup.start
? sketchGroup.start.from
: getCoordsFromPaths(sketchGroup, 0)
const geo = lineGeo({
from: [...from, 0],
to: [...to, 0],
@ -1509,7 +1511,7 @@ export const closee: InternalFn = (
},
}
const newValue = [...sketchGroup.value]
newValue[0] = currentPath
newValue.push(currentPath)
return {
...sketchGroup,
value: newValue,