Circle function and UI tool (#3860)

* circle

* fix another example

* fix bad comment

* toPoint fix

* cargo fmt

* resolve most of the tests

* fix last test

* missed circle in bracket

* remove console error

* fmt

* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest)

* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest)

* trigger ci

* remove three dot menu for circle

* make sure circle can be extruded

* fix up after merge

* add extrude test for circle

* clean up

* typo

* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest)

* Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest)"

This reverts commit 03f8eeb542.

* update docs again

* cmd bar test serialisation improvements

* tiny clean up

* fix after: Replace kittycad crate with kittycad-modeling-cmds

* fmt

* rename fix

* Update src/lib/toolbar.ts

Co-authored-by: Frank Noirot <frank@zoo.dev>

* add another error to list

* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest)

* image updates

* Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest)"

This reverts commit 505bb20bea.

* update markdown

* skip un reproducable windows test failure

* rust review

* leave issue todo comment

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Frank Noirot <frank@zoo.dev>
This commit is contained in:
Kurt Hutten
2024-09-23 22:42:51 +10:00
committed by GitHub
parent 7848d63177
commit f1b0e40388
122 changed files with 22670 additions and 512 deletions

View File

@ -59,6 +59,7 @@ export type LineInputsType =
| 'length'
| 'intersectionOffset'
| 'intersectionTag'
| 'radius'
export type ConstraintType =
| 'equalLength'
@ -89,7 +90,10 @@ function createCallWrapper(
tag?: Expr,
valueUsedInTransform?: number
): CreatedSketchExprResult {
const args = [createFirstArg(tooltip, val), createPipeSubstitution()]
const args =
tooltip === 'circle'
? []
: [createFirstArg(tooltip, val), createPipeSubstitution()]
if (tag) {
args.push(tag)
}
@ -1735,11 +1739,20 @@ export function transformAstSketchLines({
pathToNode: _pathToNode,
referencedSegment,
fnName: transformTo || (callExp.node.callee.name as ToolTip),
segmentInput: {
type: 'straight-segment',
to,
from,
},
segmentInput:
seg.type === 'Circle'
? {
type: 'arc-segment',
center: seg.center,
radius: seg.radius,
from,
}
: {
type: 'straight-segment',
to,
from,
},
replaceExistingCallback: (rawArgs) =>
callBack({
referenceSegName: _referencedSegmentName,
@ -1888,6 +1901,6 @@ export function isExprBinaryPart(expr: Expr): expr is BinaryPart {
return false
}
function getInputOfType(a: InputArgs, b: LineInputsType): InputArg {
function getInputOfType(a: InputArgs, b: LineInputsType | 'radius'): InputArg {
return a.find(({ argType }) => argType === b) || a[0]
}