Files
modeling-app/src/lib/selections.ts

781 lines
23 KiB
TypeScript
Raw Normal View History

Sort imports (#6101) * add package.json Signed-off-by: Jess Frazelle <github@jessfraz.com> initial run; Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> more fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> clientsidescne Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> paths Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> fix styles Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> combine Signed-off-by: Jess Frazelle <github@jessfraz.com> eslint rule Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> my ocd Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> constants file Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> no more import sceneInfra Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> try fix circular import Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-04-01 23:54:26 -07:00
import type { SelectionRange } from '@codemirror/state'
import { EditorSelection } from '@codemirror/state'
import type { Models } from '@kittycad/lib'
import type { Object3D, Object3DEventMap } from 'three'
import { Mesh } from 'three'
import type { Node } from '@rust/kcl-lib/bindings/Node'
import {
SEGMENT_BODIES_PLUS_PROFILE_START,
getParentGroup,
} from '@src/clientSideScene/sceneConstants'
import { AXIS_GROUP, X_AXIS } from '@src/clientSideScene/sceneUtils'
Sort imports (#6101) * add package.json Signed-off-by: Jess Frazelle <github@jessfraz.com> initial run; Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> more fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> clientsidescne Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> paths Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> fix styles Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> combine Signed-off-by: Jess Frazelle <github@jessfraz.com> eslint rule Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> my ocd Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> constants file Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> no more import sceneInfra Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> try fix circular import Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-04-01 23:54:26 -07:00
import { getNodeFromPath, isSingleCursorInPipe } from '@src/lang/queryAst'
import { getNodePathFromSourceRange } from '@src/lang/queryAstNodePathUtils'
import type { Artifact, ArtifactId, CodeRef } from '@src/lang/std/artifactGraph'
import { getCodeRefsByArtifactId } from '@src/lang/std/artifactGraph'
import type { PathToNodeMap } from '@src/lang/std/sketchcombos'
import { isCursorInSketchCommandRange, topLevelRange } from '@src/lang/util'
import type {
ArtifactGraph,
CallExpressionKw,
Expr,
Program,
SourceRange,
} from '@src/lang/wasm'
import { defaultSourceRange } from '@src/lang/wasm'
import type { ArtifactEntry, ArtifactIndex } from '@src/lib/artifactIndex'
import type { CommandArgument } from '@src/lib/commandTypes'
import type { DefaultPlaneStr } from '@src/lib/planes'
import {
codeManager,
engineCommandManager,
kclManager,
Sort imports (#6101) * add package.json Signed-off-by: Jess Frazelle <github@jessfraz.com> initial run; Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> more fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> clientsidescne Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> paths Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> fix styles Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> combine Signed-off-by: Jess Frazelle <github@jessfraz.com> eslint rule Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> my ocd Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> constants file Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> no more import sceneInfra Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> try fix circular import Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-04-01 23:54:26 -07:00
rustContext,
sceneEntitiesManager,
Sort imports (#6101) * add package.json Signed-off-by: Jess Frazelle <github@jessfraz.com> initial run; Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> more fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> clientsidescne Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> paths Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> fix styles Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> combine Signed-off-by: Jess Frazelle <github@jessfraz.com> eslint rule Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> my ocd Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> constants file Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> no more import sceneInfra Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> try fix circular import Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-04-01 23:54:26 -07:00
} from '@src/lib/singletons'
import { err } from '@src/lib/trap'
import {
Sort imports (#6101) * add package.json Signed-off-by: Jess Frazelle <github@jessfraz.com> initial run; Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> more fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> clientsidescne Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> paths Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> fix styles Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> combine Signed-off-by: Jess Frazelle <github@jessfraz.com> eslint rule Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> my ocd Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> constants file Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> no more import sceneInfra Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> try fix circular import Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-04-01 23:54:26 -07:00
getNormalisedCoordinates,
isArray,
Sort imports (#6101) * add package.json Signed-off-by: Jess Frazelle <github@jessfraz.com> initial run; Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> more fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> clientsidescne Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> paths Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> fix styles Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> combine Signed-off-by: Jess Frazelle <github@jessfraz.com> eslint rule Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> my ocd Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> constants file Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> no more import sceneInfra Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> try fix circular import Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-04-01 23:54:26 -07:00
isNonNullable,
isOverlap,
uuidv4,
} from '@src/lib/utils'
Nadro/adhoc/system io machine (#6352) * chore: saving off skeleton * fix: saving skeleton * chore: skeleton for loading projects from project directory path * chore: cleaning up useless state transition to be an on event direct to action state * fix: new structure for web vs desktop vs react machine provider code * chore: saving off skeleton * fix: skeleton logic for react? going to move it from a string to obj.string * fix: trying to prevent error element unmount on global react components. This is bricking JS state * fix: we are so back * chore: implemented navigating to specfic KCL file * chore: implementing renaming project * chore: deleting project * fix: auto fixes * fix: old debug/testing file oops * chore: generic create new file * chore: skeleton for web create file provide * chore: basic machine vitest... need to figure out how to get window.electron implemented in vitest? * chore: save off progress before deleting other project implementation, a few missing features still * chore: trying a different init skeleton? most likely will migrate * chore: first attempt of purging projects context provider * chore: enabling toast for some machine state * chore: enabling more toast success and error * chore: writing read write state to the system io based on the project path * fix: tsc fixes * fix: use file system watcher, navigate to project after creation via the requestProjectName * chore: open project command, hooks vs snapshot context helpers * chore: implemented open and create project for e2e testing. They are hard coded in poor spot for now. * fix: codespell fixes * chore: implementing more project commands * chore: PR improvements for root.tsx * chore: leaving comment about new Router.tsx layout * fix: removing debugging code * fix: rewriting component for readability * fix: improving web initialization * chore: implementing import file from url which is not actually that? * fix: clearing search params on import file from url * fix: fixed two e2e tests, forgot needsReview when making new command * fix: fixing some import from url business logic to pass e2e tests * chore: script for diffing circular deps +/- * fix: formatting * fix: massive fix for circular depsga! * fix: trying to fix some errors and auto fmt * fix: updating deps * fix: removing debugging code * fix: big clean up * fix: more deletion * fix: tsc cleanup * fix: TSC TSC TSC TSC! * fix: typo fix * fix: clear query params on web only, desktop not required * fix: removing unused code * fmt * Bring back `trap` removed in merge * Use explicit types instead of `any`s on arg configs * Add project commands directly to command palette * fix: deleting debugging code, from PR review * fix: this got added back(?) * fix: using referred type * fix: more PR clean up * fix: big block comment for xstate architecture decision * fix: more pr comment fixes * fix: merge conflict just added them back why dude * fix: more PR comments * fix: big ciruclar deps fix, commandBarActor in appActor --------- Co-authored-by: Frank Noirot <frankjohnson1993@gmail.com>
2025-04-24 13:32:49 -05:00
import { engineStreamActor } from '@src/lib/singletons'
Sort imports (#6101) * add package.json Signed-off-by: Jess Frazelle <github@jessfraz.com> initial run; Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> more fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> clientsidescne Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> paths Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> fix styles Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> combine Signed-off-by: Jess Frazelle <github@jessfraz.com> eslint rule Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> my ocd Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> constants file Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> no more import sceneInfra Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> try fix circular import Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-04-01 23:54:26 -07:00
import type { ModelingMachineEvent } from '@src/machines/modelingMachine'
import { showUnsupportedSelectionToast } from '@src/components/ToastUnsupportedSelection'
export const X_AXIS_UUID = 'ad792545-7fd3-482a-a602-a93924e3055b'
export const Y_AXIS_UUID = '680fd157-266f-4b8a-984f-cdf46b8bdf01'
export type Axis = 'y-axis' | 'x-axis' | 'z-axis'
export type DefaultPlaneSelection = {
name: DefaultPlaneStr
id: string
}
export type NonCodeSelection = Axis | DefaultPlaneSelection
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
export interface Selection {
artifact?: Artifact
codeRef: CodeRef
}
export type Selections = {
otherSelections: Array<NonCodeSelection>
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
graphSelections: Array<Selection>
}
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
export async function getEventForSelectWithPoint({
data,
}: Extract<
Models['OkModelingCmdResponse_type'],
{ type: 'select_with_point' }
>): Promise<ModelingMachineEvent | null> {
if (!data?.entity_id) {
return {
type: 'Set selection',
data: { selectionType: 'singleCodeCursor' },
}
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
}
if ([X_AXIS_UUID, Y_AXIS_UUID].includes(data.entity_id)) {
return {
type: 'Set selection',
data: {
selectionType: 'axisSelection',
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
selection: X_AXIS_UUID === data.entity_id ? 'x-axis' : 'y-axis',
},
}
}
// Check for default plane selection
const foundDefaultPlane =
rustContext.defaultPlanes !== null &&
Object.entries(rustContext.defaultPlanes).find(
([, plane]) => plane === data.entity_id
)
if (foundDefaultPlane) {
return {
type: 'Set selection',
data: {
selectionType: 'defaultPlaneSelection',
selection: {
name: foundDefaultPlane[0] as DefaultPlaneStr,
id: data.entity_id,
},
},
}
}
let _artifact = kclManager.artifactGraph.get(data.entity_id)
if (!_artifact) {
// if there's no artifact but there is a data.entity_id, it means we don't recognize the engine entity
// we should still return an empty singleCodeCursor to plug into the selection logic
// (i.e. if the user is holding shift they can keep selecting)
// but we should also put up a toast
// toast.error('some edges or faces are not currently selectable')
showUnsupportedSelectionToast()
return {
type: 'Set selection',
data: { selectionType: 'singleCodeCursor' },
}
}
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
const codeRefs = getCodeRefsByArtifactId(
data.entity_id,
kclManager.artifactGraph
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
)
if (_artifact && codeRefs) {
return {
type: 'Set selection',
data: {
selectionType: 'singleCodeCursor',
selection: {
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
artifact: _artifact,
codeRef: codeRefs[0],
},
},
}
}
return null
}
Client sketch scene (#1271) * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * make tsc happ * better error msg * fix control point issue * basic code gen working for tangentialArc * partical fix for move with arcs * tangential arc move * fix * make eslint rules less annoying * inital refactor of some xstate stuff * more old tangential arc clean up stuff * more tweaks * add testing * tweak xstate inspect * temp remove test * update formating for less conflicts * fix state machine layout after merge * shrug, something weird with xstate typegen * renaming some xstate events * tweak numbers to make CI playwright happ * CI hacks * more CI hacks * more CI hacks * new hack strategy * run tests agian * make cmd bar less flaky * ci hacks * CI hacks * CI hacks * CI hacks * clean up * fix * still have constraint stuff to deal with * progress on move rules * update source ranges after no execute code-mod * typo * mvp working * hide show sketch overlay * match scaling * update arrow head style * animate line tool * bypass xstate for animations, much smoother * add new segment working with refactor needed for setup paper sketch * refactor setup paper sketch * tangantialArcTo drag animations working * tangential arc polish * cargo fmt * clippy * more clippy * mock canvas * last of clippy? * typo * more clippy stuff * move util function so they are shareable with typescript * migrate a bunch to rust and only rust * add arc center point for draft tangential ac * clippy tweak * delete uneeded test * Rough start to scaling arrow heads. The tangent arrow heads are basically nuked and replaced while the straight line sections are just rotated and repositioned, this means they miss out on updating scaling number after a screen size changes. Needs fixing * fix bug with tool tips * fix draft line start position Having drag the end of teh path before selecting a tooltip would result in the draft line starting where the path used to end, stale data * some progress with pan maybe * fmt * inital camera sync working For perspective camera at least * change three.js to use z-up * add grid * orthographic camera working with polish items TODO * fix zoom level when swapping camera * fix up camera/orbit changing on cam change (pan wasn't being respected) * tidy up * use orbit target instead of assuming scene center * dynamic fov working * animate orthographic to perspective and reverse * fix import * temp fix for batch commands * initial client side scene sketch working * remove hover log * FOV adjust fix * fix comment * tear down sketch and small tweaks * some progress with camera tweening * combine dollyZoom engine commands see https://github.com/KittyCAD/modeling-api/compare/kurt-perspective-settings?expand=1 and https://github.com/KittyCAD/engine/compare/kurt-perspective-settings?expand=1 * make tests happy (mocks) * fix tween to vertical/camera-up bug * tween to each axis with hacky solutions in there * fix startSketchOn planes * tidy startSketchOn * tweening okay for now I think * get sketching on default planes working * allow editing on all default planes * clean up enter and exit sketch logic * tidy * tidy * remove more default plane stuff * start of draft line * remove some annoying parts of the paper.js implementation * fix drag than equip line bug * comment * don't animate on skech tear down since it's used for draft line * remove more default plane shit * style draft line * refine dashed line * draft line set up and tear down mostly happy * add on click logic ready for draft lines * sketch mode with drag and draft mode working solidly now, straight segments only * default planes match colors, hover and select still TODO * hover and click logic working for default planes Now just need the code mode to fire to 'startSketchOn(...)' * select default planes * remove some logs * fix update infinite loop * start of orbitControls port to Franks control guards * hiding scenes at different times * scene hide on camera move should be respected by scroll zoom * basic hover working * Hook up user camera settings to ClientSideScene (#1334) * Refactor to not import utilities from Router.tsx * Stop tracking changes or formatting *.typegen.ts * Hook up cameraControls to ClientSideScene * Remove camera controls toggle from temp debug panel --------- Co-authored-by: Kurt Hutten Irev-Dev <k.hutten@protonmail.ch> * add select segment moves cursor * highlight segments yellow on hover * cursor ranges effect 2d line colors * fix constrainst i.e. make sure the sketch is rejiged * selecting nothing should remove selections * remove hardcoded strings * update get_tangential_arc_to_info rust util * initial drawing of tangential arcs in client scene * fix tangentialArc arrow head direction * correct userData types for tangential arcs * get tangential arc updates working Doesn't include draging the head of the tangential arc itself yet * spot of clean up * make selections work with tangential arcs * get draft tangential segment animated * fix initial click weirdness for adding new tangential line * couple tweaks * add grace pixels /threshold to raycast * redo arc dashes so that they spawn from the ccenter of the arc * fix multi drag bug * fmt * add temp solution for close * add default axis hover colors, still needs select logic * selection of axis works, just with out selection color * get axis selection colors working * fix outdate source ranges after drag problem * update moreNodePathFromSourceRange * fix ts-rs issue/workaround * fix default plane weirdness * fix tangential arc rounding issue * review clean up part 1 * review clean up part 2 Big state-diagram cull * clippy * typo * clippy * fix xstate types with typegen * fix types * clippy * catch error * fix test import issue Not sure exactly what was happening but guessing circular import that vite didn't like * add axis/plane info to sketch group tests * case changes because of rs-ts bug, can probably revert this later * start of playwright test fixes * reduce geo complexity for straight segments * fix cam adjust tests * Revert "Clean up vite build warnings (#1332)" This reverts commit c1f661ab5254458c3e9fdb396a31860a22c790f1. * selection e2e test fixed< * remove camToggle to allow playwright tests to pass * remove drag test too brittle and needs to be redone from the ground up anyway * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * fix last test * clean up part 3 * clean up part 4 * clean up part 5 * clean up sketch enter exit logic * fix engine side selections * default plane should not be selected form 'onDragEnd' i.e. rotating the camera should not mean the user acidently selects a plane * clean up state diagram around animating to sketch mode Embracing that the animation is async and puting the interdiate steps in the state diagram clean up some logic and solved some bugs at the same time * add test for multiple sketches * typo * make highlight more robust * type tweak * scale segmenst with distance from camera so they have a consistent pixel size/ screenspace size * Jess's advice * tsc and fmt * clean up part 6 remove integer from xstate names * clean up part 7 * integrate sequency in to camera moves * fix tests * update snapshot e2e * small snapshot change * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * trigger ci * Fix HomeLoaderData types * update std stuff * update kittycad rs client lib --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Frank Noirot <frank@kittycad.io> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-02-11 12:59:00 +11:00
export function getEventForSegmentSelection(
SketchOnFace UI (#1664) * always enter edit mode * initial blocking of extra code-mirror updates * dry out code * rejig selections * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * clean up * stream clean up * update export * sketch mode can be entered and exited for extrude faces But has bugs * startSketchOn working in some cases, editsketch animation working but not orientation of instersection plane etc * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit 406fca4c553681fbad882167a9c1ab380af52899. * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * remove comment * add sketch on face e2e test * tweenCamToNegYAxis should respect reduced motion * initial sketch on face working with test * remove temporary toolbar button and xState flow * un-used vars * snapshot test tweak * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * type tidy up * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit c39b8ebf954fa63556e21da081031b8acd77c909. * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit fecf6f490af6ced34959653984108958fb504f82. * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * rename * sketch on sketch on sketch * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * typo * startSketchOn Endcaps end works, start is weird still * clear selections for entity_ids that are not recognised * fix sketch on end cap of second order extrustion * tiny clean up * fix sketch on close segment/face * clean up 'lastCodeMirrorSelectionUpdatedFromScene' * add code mode test for sketchOnExtrudedFace * make end cap selection more robust * update js artifacts for extrudes * update kcl docs * clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-22 10:23:04 +11:00
obj: Object3D<Object3DEventMap>
Client sketch scene (#1271) * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * make tsc happ * better error msg * fix control point issue * basic code gen working for tangentialArc * partical fix for move with arcs * tangential arc move * fix * make eslint rules less annoying * inital refactor of some xstate stuff * more old tangential arc clean up stuff * more tweaks * add testing * tweak xstate inspect * temp remove test * update formating for less conflicts * fix state machine layout after merge * shrug, something weird with xstate typegen * renaming some xstate events * tweak numbers to make CI playwright happ * CI hacks * more CI hacks * more CI hacks * new hack strategy * run tests agian * make cmd bar less flaky * ci hacks * CI hacks * CI hacks * CI hacks * clean up * fix * still have constraint stuff to deal with * progress on move rules * update source ranges after no execute code-mod * typo * mvp working * hide show sketch overlay * match scaling * update arrow head style * animate line tool * bypass xstate for animations, much smoother * add new segment working with refactor needed for setup paper sketch * refactor setup paper sketch * tangantialArcTo drag animations working * tangential arc polish * cargo fmt * clippy * more clippy * mock canvas * last of clippy? * typo * more clippy stuff * move util function so they are shareable with typescript * migrate a bunch to rust and only rust * add arc center point for draft tangential ac * clippy tweak * delete uneeded test * Rough start to scaling arrow heads. The tangent arrow heads are basically nuked and replaced while the straight line sections are just rotated and repositioned, this means they miss out on updating scaling number after a screen size changes. Needs fixing * fix bug with tool tips * fix draft line start position Having drag the end of teh path before selecting a tooltip would result in the draft line starting where the path used to end, stale data * some progress with pan maybe * fmt * inital camera sync working For perspective camera at least * change three.js to use z-up * add grid * orthographic camera working with polish items TODO * fix zoom level when swapping camera * fix up camera/orbit changing on cam change (pan wasn't being respected) * tidy up * use orbit target instead of assuming scene center * dynamic fov working * animate orthographic to perspective and reverse * fix import * temp fix for batch commands * initial client side scene sketch working * remove hover log * FOV adjust fix * fix comment * tear down sketch and small tweaks * some progress with camera tweening * combine dollyZoom engine commands see https://github.com/KittyCAD/modeling-api/compare/kurt-perspective-settings?expand=1 and https://github.com/KittyCAD/engine/compare/kurt-perspective-settings?expand=1 * make tests happy (mocks) * fix tween to vertical/camera-up bug * tween to each axis with hacky solutions in there * fix startSketchOn planes * tidy startSketchOn * tweening okay for now I think * get sketching on default planes working * allow editing on all default planes * clean up enter and exit sketch logic * tidy * tidy * remove more default plane stuff * start of draft line * remove some annoying parts of the paper.js implementation * fix drag than equip line bug * comment * don't animate on skech tear down since it's used for draft line * remove more default plane shit * style draft line * refine dashed line * draft line set up and tear down mostly happy * add on click logic ready for draft lines * sketch mode with drag and draft mode working solidly now, straight segments only * default planes match colors, hover and select still TODO * hover and click logic working for default planes Now just need the code mode to fire to 'startSketchOn(...)' * select default planes * remove some logs * fix update infinite loop * start of orbitControls port to Franks control guards * hiding scenes at different times * scene hide on camera move should be respected by scroll zoom * basic hover working * Hook up user camera settings to ClientSideScene (#1334) * Refactor to not import utilities from Router.tsx * Stop tracking changes or formatting *.typegen.ts * Hook up cameraControls to ClientSideScene * Remove camera controls toggle from temp debug panel --------- Co-authored-by: Kurt Hutten Irev-Dev <k.hutten@protonmail.ch> * add select segment moves cursor * highlight segments yellow on hover * cursor ranges effect 2d line colors * fix constrainst i.e. make sure the sketch is rejiged * selecting nothing should remove selections * remove hardcoded strings * update get_tangential_arc_to_info rust util * initial drawing of tangential arcs in client scene * fix tangentialArc arrow head direction * correct userData types for tangential arcs * get tangential arc updates working Doesn't include draging the head of the tangential arc itself yet * spot of clean up * make selections work with tangential arcs * get draft tangential segment animated * fix initial click weirdness for adding new tangential line * couple tweaks * add grace pixels /threshold to raycast * redo arc dashes so that they spawn from the ccenter of the arc * fix multi drag bug * fmt * add temp solution for close * add default axis hover colors, still needs select logic * selection of axis works, just with out selection color * get axis selection colors working * fix outdate source ranges after drag problem * update moreNodePathFromSourceRange * fix ts-rs issue/workaround * fix default plane weirdness * fix tangential arc rounding issue * review clean up part 1 * review clean up part 2 Big state-diagram cull * clippy * typo * clippy * fix xstate types with typegen * fix types * clippy * catch error * fix test import issue Not sure exactly what was happening but guessing circular import that vite didn't like * add axis/plane info to sketch group tests * case changes because of rs-ts bug, can probably revert this later * start of playwright test fixes * reduce geo complexity for straight segments * fix cam adjust tests * Revert "Clean up vite build warnings (#1332)" This reverts commit c1f661ab5254458c3e9fdb396a31860a22c790f1. * selection e2e test fixed< * remove camToggle to allow playwright tests to pass * remove drag test too brittle and needs to be redone from the ground up anyway * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * fix last test * clean up part 3 * clean up part 4 * clean up part 5 * clean up sketch enter exit logic * fix engine side selections * default plane should not be selected form 'onDragEnd' i.e. rotating the camera should not mean the user acidently selects a plane * clean up state diagram around animating to sketch mode Embracing that the animation is async and puting the interdiate steps in the state diagram clean up some logic and solved some bugs at the same time * add test for multiple sketches * typo * make highlight more robust * type tweak * scale segmenst with distance from camera so they have a consistent pixel size/ screenspace size * Jess's advice * tsc and fmt * clean up part 6 remove integer from xstate names * clean up part 7 * integrate sequency in to camera moves * fix tests * update snapshot e2e * small snapshot change * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * trigger ci * Fix HomeLoaderData types * update std stuff * update kittycad rs client lib --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Frank Noirot <frank@kittycad.io> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-02-11 12:59:00 +11:00
): ModelingMachineEvent | null {
const group = getParentGroup(obj, SEGMENT_BODIES_PLUS_PROFILE_START)
Client sketch scene (#1271) * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * make tsc happ * better error msg * fix control point issue * basic code gen working for tangentialArc * partical fix for move with arcs * tangential arc move * fix * make eslint rules less annoying * inital refactor of some xstate stuff * more old tangential arc clean up stuff * more tweaks * add testing * tweak xstate inspect * temp remove test * update formating for less conflicts * fix state machine layout after merge * shrug, something weird with xstate typegen * renaming some xstate events * tweak numbers to make CI playwright happ * CI hacks * more CI hacks * more CI hacks * new hack strategy * run tests agian * make cmd bar less flaky * ci hacks * CI hacks * CI hacks * CI hacks * clean up * fix * still have constraint stuff to deal with * progress on move rules * update source ranges after no execute code-mod * typo * mvp working * hide show sketch overlay * match scaling * update arrow head style * animate line tool * bypass xstate for animations, much smoother * add new segment working with refactor needed for setup paper sketch * refactor setup paper sketch * tangantialArcTo drag animations working * tangential arc polish * cargo fmt * clippy * more clippy * mock canvas * last of clippy? * typo * more clippy stuff * move util function so they are shareable with typescript * migrate a bunch to rust and only rust * add arc center point for draft tangential ac * clippy tweak * delete uneeded test * Rough start to scaling arrow heads. The tangent arrow heads are basically nuked and replaced while the straight line sections are just rotated and repositioned, this means they miss out on updating scaling number after a screen size changes. Needs fixing * fix bug with tool tips * fix draft line start position Having drag the end of teh path before selecting a tooltip would result in the draft line starting where the path used to end, stale data * some progress with pan maybe * fmt * inital camera sync working For perspective camera at least * change three.js to use z-up * add grid * orthographic camera working with polish items TODO * fix zoom level when swapping camera * fix up camera/orbit changing on cam change (pan wasn't being respected) * tidy up * use orbit target instead of assuming scene center * dynamic fov working * animate orthographic to perspective and reverse * fix import * temp fix for batch commands * initial client side scene sketch working * remove hover log * FOV adjust fix * fix comment * tear down sketch and small tweaks * some progress with camera tweening * combine dollyZoom engine commands see https://github.com/KittyCAD/modeling-api/compare/kurt-perspective-settings?expand=1 and https://github.com/KittyCAD/engine/compare/kurt-perspective-settings?expand=1 * make tests happy (mocks) * fix tween to vertical/camera-up bug * tween to each axis with hacky solutions in there * fix startSketchOn planes * tidy startSketchOn * tweening okay for now I think * get sketching on default planes working * allow editing on all default planes * clean up enter and exit sketch logic * tidy * tidy * remove more default plane stuff * start of draft line * remove some annoying parts of the paper.js implementation * fix drag than equip line bug * comment * don't animate on skech tear down since it's used for draft line * remove more default plane shit * style draft line * refine dashed line * draft line set up and tear down mostly happy * add on click logic ready for draft lines * sketch mode with drag and draft mode working solidly now, straight segments only * default planes match colors, hover and select still TODO * hover and click logic working for default planes Now just need the code mode to fire to 'startSketchOn(...)' * select default planes * remove some logs * fix update infinite loop * start of orbitControls port to Franks control guards * hiding scenes at different times * scene hide on camera move should be respected by scroll zoom * basic hover working * Hook up user camera settings to ClientSideScene (#1334) * Refactor to not import utilities from Router.tsx * Stop tracking changes or formatting *.typegen.ts * Hook up cameraControls to ClientSideScene * Remove camera controls toggle from temp debug panel --------- Co-authored-by: Kurt Hutten Irev-Dev <k.hutten@protonmail.ch> * add select segment moves cursor * highlight segments yellow on hover * cursor ranges effect 2d line colors * fix constrainst i.e. make sure the sketch is rejiged * selecting nothing should remove selections * remove hardcoded strings * update get_tangential_arc_to_info rust util * initial drawing of tangential arcs in client scene * fix tangentialArc arrow head direction * correct userData types for tangential arcs * get tangential arc updates working Doesn't include draging the head of the tangential arc itself yet * spot of clean up * make selections work with tangential arcs * get draft tangential segment animated * fix initial click weirdness for adding new tangential line * couple tweaks * add grace pixels /threshold to raycast * redo arc dashes so that they spawn from the ccenter of the arc * fix multi drag bug * fmt * add temp solution for close * add default axis hover colors, still needs select logic * selection of axis works, just with out selection color * get axis selection colors working * fix outdate source ranges after drag problem * update moreNodePathFromSourceRange * fix ts-rs issue/workaround * fix default plane weirdness * fix tangential arc rounding issue * review clean up part 1 * review clean up part 2 Big state-diagram cull * clippy * typo * clippy * fix xstate types with typegen * fix types * clippy * catch error * fix test import issue Not sure exactly what was happening but guessing circular import that vite didn't like * add axis/plane info to sketch group tests * case changes because of rs-ts bug, can probably revert this later * start of playwright test fixes * reduce geo complexity for straight segments * fix cam adjust tests * Revert "Clean up vite build warnings (#1332)" This reverts commit c1f661ab5254458c3e9fdb396a31860a22c790f1. * selection e2e test fixed< * remove camToggle to allow playwright tests to pass * remove drag test too brittle and needs to be redone from the ground up anyway * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * fix last test * clean up part 3 * clean up part 4 * clean up part 5 * clean up sketch enter exit logic * fix engine side selections * default plane should not be selected form 'onDragEnd' i.e. rotating the camera should not mean the user acidently selects a plane * clean up state diagram around animating to sketch mode Embracing that the animation is async and puting the interdiate steps in the state diagram clean up some logic and solved some bugs at the same time * add test for multiple sketches * typo * make highlight more robust * type tweak * scale segmenst with distance from camera so they have a consistent pixel size/ screenspace size * Jess's advice * tsc and fmt * clean up part 6 remove integer from xstate names * clean up part 7 * integrate sequency in to camera moves * fix tests * update snapshot e2e * small snapshot change * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * trigger ci * Fix HomeLoaderData types * update std stuff * update kittycad rs client lib --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Frank Noirot <frank@kittycad.io> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-02-11 12:59:00 +11:00
const axisGroup = getParentGroup(obj, [AXIS_GROUP])
if (!group && !axisGroup) return null
if (axisGroup?.userData.type === AXIS_GROUP) {
return {
type: 'Set selection',
data: {
selectionType: 'axisSelection',
Client sketch scene (#1271) * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * make tsc happ * better error msg * fix control point issue * basic code gen working for tangentialArc * partical fix for move with arcs * tangential arc move * fix * make eslint rules less annoying * inital refactor of some xstate stuff * more old tangential arc clean up stuff * more tweaks * add testing * tweak xstate inspect * temp remove test * update formating for less conflicts * fix state machine layout after merge * shrug, something weird with xstate typegen * renaming some xstate events * tweak numbers to make CI playwright happ * CI hacks * more CI hacks * more CI hacks * new hack strategy * run tests agian * make cmd bar less flaky * ci hacks * CI hacks * CI hacks * CI hacks * clean up * fix * still have constraint stuff to deal with * progress on move rules * update source ranges after no execute code-mod * typo * mvp working * hide show sketch overlay * match scaling * update arrow head style * animate line tool * bypass xstate for animations, much smoother * add new segment working with refactor needed for setup paper sketch * refactor setup paper sketch * tangantialArcTo drag animations working * tangential arc polish * cargo fmt * clippy * more clippy * mock canvas * last of clippy? * typo * more clippy stuff * move util function so they are shareable with typescript * migrate a bunch to rust and only rust * add arc center point for draft tangential ac * clippy tweak * delete uneeded test * Rough start to scaling arrow heads. The tangent arrow heads are basically nuked and replaced while the straight line sections are just rotated and repositioned, this means they miss out on updating scaling number after a screen size changes. Needs fixing * fix bug with tool tips * fix draft line start position Having drag the end of teh path before selecting a tooltip would result in the draft line starting where the path used to end, stale data * some progress with pan maybe * fmt * inital camera sync working For perspective camera at least * change three.js to use z-up * add grid * orthographic camera working with polish items TODO * fix zoom level when swapping camera * fix up camera/orbit changing on cam change (pan wasn't being respected) * tidy up * use orbit target instead of assuming scene center * dynamic fov working * animate orthographic to perspective and reverse * fix import * temp fix for batch commands * initial client side scene sketch working * remove hover log * FOV adjust fix * fix comment * tear down sketch and small tweaks * some progress with camera tweening * combine dollyZoom engine commands see https://github.com/KittyCAD/modeling-api/compare/kurt-perspective-settings?expand=1 and https://github.com/KittyCAD/engine/compare/kurt-perspective-settings?expand=1 * make tests happy (mocks) * fix tween to vertical/camera-up bug * tween to each axis with hacky solutions in there * fix startSketchOn planes * tidy startSketchOn * tweening okay for now I think * get sketching on default planes working * allow editing on all default planes * clean up enter and exit sketch logic * tidy * tidy * remove more default plane stuff * start of draft line * remove some annoying parts of the paper.js implementation * fix drag than equip line bug * comment * don't animate on skech tear down since it's used for draft line * remove more default plane shit * style draft line * refine dashed line * draft line set up and tear down mostly happy * add on click logic ready for draft lines * sketch mode with drag and draft mode working solidly now, straight segments only * default planes match colors, hover and select still TODO * hover and click logic working for default planes Now just need the code mode to fire to 'startSketchOn(...)' * select default planes * remove some logs * fix update infinite loop * start of orbitControls port to Franks control guards * hiding scenes at different times * scene hide on camera move should be respected by scroll zoom * basic hover working * Hook up user camera settings to ClientSideScene (#1334) * Refactor to not import utilities from Router.tsx * Stop tracking changes or formatting *.typegen.ts * Hook up cameraControls to ClientSideScene * Remove camera controls toggle from temp debug panel --------- Co-authored-by: Kurt Hutten Irev-Dev <k.hutten@protonmail.ch> * add select segment moves cursor * highlight segments yellow on hover * cursor ranges effect 2d line colors * fix constrainst i.e. make sure the sketch is rejiged * selecting nothing should remove selections * remove hardcoded strings * update get_tangential_arc_to_info rust util * initial drawing of tangential arcs in client scene * fix tangentialArc arrow head direction * correct userData types for tangential arcs * get tangential arc updates working Doesn't include draging the head of the tangential arc itself yet * spot of clean up * make selections work with tangential arcs * get draft tangential segment animated * fix initial click weirdness for adding new tangential line * couple tweaks * add grace pixels /threshold to raycast * redo arc dashes so that they spawn from the ccenter of the arc * fix multi drag bug * fmt * add temp solution for close * add default axis hover colors, still needs select logic * selection of axis works, just with out selection color * get axis selection colors working * fix outdate source ranges after drag problem * update moreNodePathFromSourceRange * fix ts-rs issue/workaround * fix default plane weirdness * fix tangential arc rounding issue * review clean up part 1 * review clean up part 2 Big state-diagram cull * clippy * typo * clippy * fix xstate types with typegen * fix types * clippy * catch error * fix test import issue Not sure exactly what was happening but guessing circular import that vite didn't like * add axis/plane info to sketch group tests * case changes because of rs-ts bug, can probably revert this later * start of playwright test fixes * reduce geo complexity for straight segments * fix cam adjust tests * Revert "Clean up vite build warnings (#1332)" This reverts commit c1f661ab5254458c3e9fdb396a31860a22c790f1. * selection e2e test fixed< * remove camToggle to allow playwright tests to pass * remove drag test too brittle and needs to be redone from the ground up anyway * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * fix last test * clean up part 3 * clean up part 4 * clean up part 5 * clean up sketch enter exit logic * fix engine side selections * default plane should not be selected form 'onDragEnd' i.e. rotating the camera should not mean the user acidently selects a plane * clean up state diagram around animating to sketch mode Embracing that the animation is async and puting the interdiate steps in the state diagram clean up some logic and solved some bugs at the same time * add test for multiple sketches * typo * make highlight more robust * type tweak * scale segmenst with distance from camera so they have a consistent pixel size/ screenspace size * Jess's advice * tsc and fmt * clean up part 6 remove integer from xstate names * clean up part 7 * integrate sequency in to camera moves * fix tests * update snapshot e2e * small snapshot change * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * trigger ci * Fix HomeLoaderData types * update std stuff * update kittycad rs client lib --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Frank Noirot <frank@kittycad.io> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-02-11 12:59:00 +11:00
selection: obj?.userData?.type === X_AXIS ? 'x-axis' : 'y-axis',
},
}
}
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
// id does not match up with the artifact graph when in sketch mode, because mock executions
// do not update the artifact graph, therefore we match up the pathToNode instead
// we can reliably use `type === 'segment'` since it's in sketch mode and we're concerned with segments
const segWithMatchingPathToNode__Id = [...kclManager.artifactGraph].find(
(entry) => {
return (
entry[1].type === 'segment' &&
JSON.stringify(entry[1].codeRef.pathToNode) ===
JSON.stringify(group?.userData?.pathToNode)
)
}
)?.[0]
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
const id = segWithMatchingPathToNode__Id
if (!id && group) {
const node = getNodeFromPath<Expr>(
kclManager.ast,
group.userData.pathToNode
)
if (err(node)) return null
return {
type: 'Set selection',
data: {
selectionType: 'singleCodeCursor',
selection: {
codeRef: {
Rust artifact graph (#5068) * Start porting artifact graph creation to Rust * Add most of artifact graph creation * Add handling loft command from recent PR * Refactor artifact merge code so that it errors when a new artifact type is added * Add sweep subtype * Finish implementation of build artifact graph * Fix wasm.ts to use new combined generated ts-rs file * Fix Rust lints * Fix lints * Fix up replacement code * Add artifact graph to WASM outcome * Add artifact graph to simulation test output * Add new artifact graph output snapshots * Fix wall field and reduce unreachable code * Change field order for subtype * Change subtype to be determined from the request, like the TS * Fix plane sweep_id * Condense code * Change ID types to be properly optional * Change to favor the new ID, the same as TS * Fix to make error impossible * Rename artifact type tag values to match TS * Fix name of field on Cap * Update outputs * Change to use Rust source range * Update output snapshots * Add conversion to mermaid mind map and add to snapshot tests * Add new mermaid mind map output * Add flowchart * Remove raw artifact graph from tests * Remove JSON artifact graph output * Update output file with header * Update output after adding flowchart * Fix flowchart to not have duplicate edges, one in each direction * Fix not not output duplicate edges in flowcharts * Change flowchart edge style to be more obvious when a direction is missing * Update output after deduplication of edges * Fix not not skip sketch-on-face artifacts * Add docs * Fix edge iteration order to be stable * Update output after fixing order * Port TS artifactGraph.test.ts tests to simulation tests * Add grouping segments and solid2ds with their path * Update output flowcharts since grouping paths * Remove TS artifactGraph tests * Remove unused d3 dependencies * Fix to track loft ID on paths * Add command ID to error messages * Move artifact graph test code to a separate file since it's a large file * Reduce function visibility * Remove TS artifact graph code * Fix spelling error with serde * Add TODO for edge cut consumed ID * Add comment about mermaid edge rank * Fix mermaid flowchart edge cuts to appear as children of their edges * Update output since fixing flowchart order * Fix to always build the artifact graph even when there's a KCL error * Add artifact graph to error output * Change optional ID merge to match TS * Remove redundant SourceRange definition * Remove Rust-flavored default source range function * Add helper for source range creation * Update doc comment for the website * Update docs after doc comment change * Fix to save engine responses in execution cache * Remove unused import * Fix to not call WASM function before beforeAll callback is run * Remove more unused imports
2025-01-17 14:34:36 -05:00
range: topLevelRange(node.node.start, node.node.end),
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
pathToNode: group.userData.pathToNode,
},
},
},
}
}
if (!id || !group) return null
const artifact = kclManager.artifactGraph.get(id)
Allow multiple profiles in the same sketch (#5196) * Revert "Revert multi-profile (#4812)" This reverts commit efe8089b08dd8bdade517f04ace2c81a5e096434. * fix poor 1000ms wait UX * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * Add Rust side artifacts for startSketchOn face or plane (#4834) * Add Rust side artifacts for startSketchOn face or plane * move ast digging --------- Co-authored-by: Kurt Hutten Irev-Dev <k.hutten@protonmail.ch> * lint * lint * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-macos-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-16-cores) * trigger CI * chore: disabled file watcher which prevents faster file write (#4835) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * partial fixes * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * Trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * Trigger CI * Fix up all the tests * Fix partial execution * wip * WIP * wip * rust changes to make three point confrom to same as others since we're not ready with name params yet * most of the fix for 3 point circle * get overlays working for circle three point * fmt * fix types * cargo fmt * add face codef ref for walls and caps * fix sketch on face after updates to rust side artifact graph * some things needed for multi-profile tests * bad attempts at fixing rust * more * more * fix rust * more rust fixes * overlay fix * remove duplicate test * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * lint and typing * maybe fix a unit test * small thing * fix circ dep * fix unit test * fix some tests * fix sweep point-and-click test * fix more tests and add a fix me * fix more tests * fix electron specific test * tsc * more test tweaks * update docs * commint snaps? * is clippy happy now? * clippy again * test works now without me changing anything big-fixed-itself * small bug * make three point have cross hair to make it consistent with othe rtools * fix up state diagram * fmt * add draft point for first click of three point circ * 1 test for three point circle * 2 test for three point circle * clean up * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * remove bad doc comment * remove test skip * remove onboarding test changes * Update src/lang/modifyAst.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * Update output from simulation tests * Fix to use correct source ranges This also reduces cloning. * Change back to skipping face cap none and both * Update output after changing back to skipping none and both * Fix clippy warning * fix profile start snap bug * add path ids to cap * fix going into edit sketch * make other startSketchOn's work * fix snapshot test * explain function name * Update src/lib/rectangleTool.ts Co-authored-by: Frank Noirot <frank@zoo.dev> * rename error * remove file tree from diff * Update src/clientSideScene/segments.ts Co-authored-by: Frank Noirot <frank@zoo.dev> * nit * Prevent double write to KCL code on revolve * Update output after adding cap-to-path graph edge * Fix edit/select sketch-on-cap via feature tree * clean up for face codeRef * fix changing tools part way through circle/rect tools * fix delete of circle profile * fix close profiles * fix closing profile bug (tangentArcTo being ignored) * remove stale comment * Delete paths associated with sketch when the sketch plane is deleted * Add support for deleting sketches on caps (not walls) * get delet working for walls * make delet of extrusions work for multi profile * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * Delete the sketch statement too on the cap and wall cases * Don't write to file in `split-sketch-pipe-if-needed` unless necessary * Don't wait for file write to complete within `updateEditorWithAstAndWriteToFile` It is already debounced internally. If we await it, we will have to wait for a debounced timeout * docs * fix circ dep * tsc * fix selection enter sketch weirdness * test fixes * comment out and fixme for delete related tests * add skip wins * try and get last test to pass --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com> Co-authored-by: Kevin Nadro <nadr0@users.noreply.github.com> Co-authored-by: Pierre Jacquier <pierre@zoo.dev> Co-authored-by: 49lf <ircsurfer33@gmail.com> Co-authored-by: Frank Noirot <frank@zoo.dev> Co-authored-by: Frank Noirot <frankjohnson1993@gmail.com>
2025-02-15 00:57:04 +11:00
if (!artifact) return null
const node = getNodeFromPath<Expr>(kclManager.ast, group.userData.pathToNode)
if (err(node)) return null
Client sketch scene (#1271) * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * make tsc happ * better error msg * fix control point issue * basic code gen working for tangentialArc * partical fix for move with arcs * tangential arc move * fix * make eslint rules less annoying * inital refactor of some xstate stuff * more old tangential arc clean up stuff * more tweaks * add testing * tweak xstate inspect * temp remove test * update formating for less conflicts * fix state machine layout after merge * shrug, something weird with xstate typegen * renaming some xstate events * tweak numbers to make CI playwright happ * CI hacks * more CI hacks * more CI hacks * new hack strategy * run tests agian * make cmd bar less flaky * ci hacks * CI hacks * CI hacks * CI hacks * clean up * fix * still have constraint stuff to deal with * progress on move rules * update source ranges after no execute code-mod * typo * mvp working * hide show sketch overlay * match scaling * update arrow head style * animate line tool * bypass xstate for animations, much smoother * add new segment working with refactor needed for setup paper sketch * refactor setup paper sketch * tangantialArcTo drag animations working * tangential arc polish * cargo fmt * clippy * more clippy * mock canvas * last of clippy? * typo * more clippy stuff * move util function so they are shareable with typescript * migrate a bunch to rust and only rust * add arc center point for draft tangential ac * clippy tweak * delete uneeded test * Rough start to scaling arrow heads. The tangent arrow heads are basically nuked and replaced while the straight line sections are just rotated and repositioned, this means they miss out on updating scaling number after a screen size changes. Needs fixing * fix bug with tool tips * fix draft line start position Having drag the end of teh path before selecting a tooltip would result in the draft line starting where the path used to end, stale data * some progress with pan maybe * fmt * inital camera sync working For perspective camera at least * change three.js to use z-up * add grid * orthographic camera working with polish items TODO * fix zoom level when swapping camera * fix up camera/orbit changing on cam change (pan wasn't being respected) * tidy up * use orbit target instead of assuming scene center * dynamic fov working * animate orthographic to perspective and reverse * fix import * temp fix for batch commands * initial client side scene sketch working * remove hover log * FOV adjust fix * fix comment * tear down sketch and small tweaks * some progress with camera tweening * combine dollyZoom engine commands see https://github.com/KittyCAD/modeling-api/compare/kurt-perspective-settings?expand=1 and https://github.com/KittyCAD/engine/compare/kurt-perspective-settings?expand=1 * make tests happy (mocks) * fix tween to vertical/camera-up bug * tween to each axis with hacky solutions in there * fix startSketchOn planes * tidy startSketchOn * tweening okay for now I think * get sketching on default planes working * allow editing on all default planes * clean up enter and exit sketch logic * tidy * tidy * remove more default plane stuff * start of draft line * remove some annoying parts of the paper.js implementation * fix drag than equip line bug * comment * don't animate on skech tear down since it's used for draft line * remove more default plane shit * style draft line * refine dashed line * draft line set up and tear down mostly happy * add on click logic ready for draft lines * sketch mode with drag and draft mode working solidly now, straight segments only * default planes match colors, hover and select still TODO * hover and click logic working for default planes Now just need the code mode to fire to 'startSketchOn(...)' * select default planes * remove some logs * fix update infinite loop * start of orbitControls port to Franks control guards * hiding scenes at different times * scene hide on camera move should be respected by scroll zoom * basic hover working * Hook up user camera settings to ClientSideScene (#1334) * Refactor to not import utilities from Router.tsx * Stop tracking changes or formatting *.typegen.ts * Hook up cameraControls to ClientSideScene * Remove camera controls toggle from temp debug panel --------- Co-authored-by: Kurt Hutten Irev-Dev <k.hutten@protonmail.ch> * add select segment moves cursor * highlight segments yellow on hover * cursor ranges effect 2d line colors * fix constrainst i.e. make sure the sketch is rejiged * selecting nothing should remove selections * remove hardcoded strings * update get_tangential_arc_to_info rust util * initial drawing of tangential arcs in client scene * fix tangentialArc arrow head direction * correct userData types for tangential arcs * get tangential arc updates working Doesn't include draging the head of the tangential arc itself yet * spot of clean up * make selections work with tangential arcs * get draft tangential segment animated * fix initial click weirdness for adding new tangential line * couple tweaks * add grace pixels /threshold to raycast * redo arc dashes so that they spawn from the ccenter of the arc * fix multi drag bug * fmt * add temp solution for close * add default axis hover colors, still needs select logic * selection of axis works, just with out selection color * get axis selection colors working * fix outdate source ranges after drag problem * update moreNodePathFromSourceRange * fix ts-rs issue/workaround * fix default plane weirdness * fix tangential arc rounding issue * review clean up part 1 * review clean up part 2 Big state-diagram cull * clippy * typo * clippy * fix xstate types with typegen * fix types * clippy * catch error * fix test import issue Not sure exactly what was happening but guessing circular import that vite didn't like * add axis/plane info to sketch group tests * case changes because of rs-ts bug, can probably revert this later * start of playwright test fixes * reduce geo complexity for straight segments * fix cam adjust tests * Revert "Clean up vite build warnings (#1332)" This reverts commit c1f661ab5254458c3e9fdb396a31860a22c790f1. * selection e2e test fixed< * remove camToggle to allow playwright tests to pass * remove drag test too brittle and needs to be redone from the ground up anyway * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * fix last test * clean up part 3 * clean up part 4 * clean up part 5 * clean up sketch enter exit logic * fix engine side selections * default plane should not be selected form 'onDragEnd' i.e. rotating the camera should not mean the user acidently selects a plane * clean up state diagram around animating to sketch mode Embracing that the animation is async and puting the interdiate steps in the state diagram clean up some logic and solved some bugs at the same time * add test for multiple sketches * typo * make highlight more robust * type tweak * scale segmenst with distance from camera so they have a consistent pixel size/ screenspace size * Jess's advice * tsc and fmt * clean up part 6 remove integer from xstate names * clean up part 7 * integrate sequency in to camera moves * fix tests * update snapshot e2e * small snapshot change * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * trigger ci * Fix HomeLoaderData types * update std stuff * update kittycad rs client lib --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Frank Noirot <frank@kittycad.io> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-02-11 12:59:00 +11:00
return {
type: 'Set selection',
data: {
selectionType: 'singleCodeCursor',
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
selection: {
artifact,
Allow multiple profiles in the same sketch (#5196) * Revert "Revert multi-profile (#4812)" This reverts commit efe8089b08dd8bdade517f04ace2c81a5e096434. * fix poor 1000ms wait UX * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * Add Rust side artifacts for startSketchOn face or plane (#4834) * Add Rust side artifacts for startSketchOn face or plane * move ast digging --------- Co-authored-by: Kurt Hutten Irev-Dev <k.hutten@protonmail.ch> * lint * lint * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-macos-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-16-cores) * trigger CI * chore: disabled file watcher which prevents faster file write (#4835) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * partial fixes * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * Trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * Trigger CI * Fix up all the tests * Fix partial execution * wip * WIP * wip * rust changes to make three point confrom to same as others since we're not ready with name params yet * most of the fix for 3 point circle * get overlays working for circle three point * fmt * fix types * cargo fmt * add face codef ref for walls and caps * fix sketch on face after updates to rust side artifact graph * some things needed for multi-profile tests * bad attempts at fixing rust * more * more * fix rust * more rust fixes * overlay fix * remove duplicate test * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * lint and typing * maybe fix a unit test * small thing * fix circ dep * fix unit test * fix some tests * fix sweep point-and-click test * fix more tests and add a fix me * fix more tests * fix electron specific test * tsc * more test tweaks * update docs * commint snaps? * is clippy happy now? * clippy again * test works now without me changing anything big-fixed-itself * small bug * make three point have cross hair to make it consistent with othe rtools * fix up state diagram * fmt * add draft point for first click of three point circ * 1 test for three point circle * 2 test for three point circle * clean up * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * remove bad doc comment * remove test skip * remove onboarding test changes * Update src/lang/modifyAst.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * Update output from simulation tests * Fix to use correct source ranges This also reduces cloning. * Change back to skipping face cap none and both * Update output after changing back to skipping none and both * Fix clippy warning * fix profile start snap bug * add path ids to cap * fix going into edit sketch * make other startSketchOn's work * fix snapshot test * explain function name * Update src/lib/rectangleTool.ts Co-authored-by: Frank Noirot <frank@zoo.dev> * rename error * remove file tree from diff * Update src/clientSideScene/segments.ts Co-authored-by: Frank Noirot <frank@zoo.dev> * nit * Prevent double write to KCL code on revolve * Update output after adding cap-to-path graph edge * Fix edit/select sketch-on-cap via feature tree * clean up for face codeRef * fix changing tools part way through circle/rect tools * fix delete of circle profile * fix close profiles * fix closing profile bug (tangentArcTo being ignored) * remove stale comment * Delete paths associated with sketch when the sketch plane is deleted * Add support for deleting sketches on caps (not walls) * get delet working for walls * make delet of extrusions work for multi profile * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * Delete the sketch statement too on the cap and wall cases * Don't write to file in `split-sketch-pipe-if-needed` unless necessary * Don't wait for file write to complete within `updateEditorWithAstAndWriteToFile` It is already debounced internally. If we await it, we will have to wait for a debounced timeout * docs * fix circ dep * tsc * fix selection enter sketch weirdness * test fixes * comment out and fixme for delete related tests * add skip wins * try and get last test to pass --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com> Co-authored-by: Kevin Nadro <nadr0@users.noreply.github.com> Co-authored-by: Pierre Jacquier <pierre@zoo.dev> Co-authored-by: 49lf <ircsurfer33@gmail.com> Co-authored-by: Frank Noirot <frank@zoo.dev> Co-authored-by: Frank Noirot <frankjohnson1993@gmail.com>
2025-02-15 00:57:04 +11:00
codeRef: {
pathToNode: group?.userData?.pathToNode,
range: [node.node.start, node.node.end, 0],
},
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
},
Client sketch scene (#1271) * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * make tsc happ * better error msg * fix control point issue * basic code gen working for tangentialArc * partical fix for move with arcs * tangential arc move * fix * make eslint rules less annoying * inital refactor of some xstate stuff * more old tangential arc clean up stuff * more tweaks * add testing * tweak xstate inspect * temp remove test * update formating for less conflicts * fix state machine layout after merge * shrug, something weird with xstate typegen * renaming some xstate events * tweak numbers to make CI playwright happ * CI hacks * more CI hacks * more CI hacks * new hack strategy * run tests agian * make cmd bar less flaky * ci hacks * CI hacks * CI hacks * CI hacks * clean up * fix * still have constraint stuff to deal with * progress on move rules * update source ranges after no execute code-mod * typo * mvp working * hide show sketch overlay * match scaling * update arrow head style * animate line tool * bypass xstate for animations, much smoother * add new segment working with refactor needed for setup paper sketch * refactor setup paper sketch * tangantialArcTo drag animations working * tangential arc polish * cargo fmt * clippy * more clippy * mock canvas * last of clippy? * typo * more clippy stuff * move util function so they are shareable with typescript * migrate a bunch to rust and only rust * add arc center point for draft tangential ac * clippy tweak * delete uneeded test * Rough start to scaling arrow heads. The tangent arrow heads are basically nuked and replaced while the straight line sections are just rotated and repositioned, this means they miss out on updating scaling number after a screen size changes. Needs fixing * fix bug with tool tips * fix draft line start position Having drag the end of teh path before selecting a tooltip would result in the draft line starting where the path used to end, stale data * some progress with pan maybe * fmt * inital camera sync working For perspective camera at least * change three.js to use z-up * add grid * orthographic camera working with polish items TODO * fix zoom level when swapping camera * fix up camera/orbit changing on cam change (pan wasn't being respected) * tidy up * use orbit target instead of assuming scene center * dynamic fov working * animate orthographic to perspective and reverse * fix import * temp fix for batch commands * initial client side scene sketch working * remove hover log * FOV adjust fix * fix comment * tear down sketch and small tweaks * some progress with camera tweening * combine dollyZoom engine commands see https://github.com/KittyCAD/modeling-api/compare/kurt-perspective-settings?expand=1 and https://github.com/KittyCAD/engine/compare/kurt-perspective-settings?expand=1 * make tests happy (mocks) * fix tween to vertical/camera-up bug * tween to each axis with hacky solutions in there * fix startSketchOn planes * tidy startSketchOn * tweening okay for now I think * get sketching on default planes working * allow editing on all default planes * clean up enter and exit sketch logic * tidy * tidy * remove more default plane stuff * start of draft line * remove some annoying parts of the paper.js implementation * fix drag than equip line bug * comment * don't animate on skech tear down since it's used for draft line * remove more default plane shit * style draft line * refine dashed line * draft line set up and tear down mostly happy * add on click logic ready for draft lines * sketch mode with drag and draft mode working solidly now, straight segments only * default planes match colors, hover and select still TODO * hover and click logic working for default planes Now just need the code mode to fire to 'startSketchOn(...)' * select default planes * remove some logs * fix update infinite loop * start of orbitControls port to Franks control guards * hiding scenes at different times * scene hide on camera move should be respected by scroll zoom * basic hover working * Hook up user camera settings to ClientSideScene (#1334) * Refactor to not import utilities from Router.tsx * Stop tracking changes or formatting *.typegen.ts * Hook up cameraControls to ClientSideScene * Remove camera controls toggle from temp debug panel --------- Co-authored-by: Kurt Hutten Irev-Dev <k.hutten@protonmail.ch> * add select segment moves cursor * highlight segments yellow on hover * cursor ranges effect 2d line colors * fix constrainst i.e. make sure the sketch is rejiged * selecting nothing should remove selections * remove hardcoded strings * update get_tangential_arc_to_info rust util * initial drawing of tangential arcs in client scene * fix tangentialArc arrow head direction * correct userData types for tangential arcs * get tangential arc updates working Doesn't include draging the head of the tangential arc itself yet * spot of clean up * make selections work with tangential arcs * get draft tangential segment animated * fix initial click weirdness for adding new tangential line * couple tweaks * add grace pixels /threshold to raycast * redo arc dashes so that they spawn from the ccenter of the arc * fix multi drag bug * fmt * add temp solution for close * add default axis hover colors, still needs select logic * selection of axis works, just with out selection color * get axis selection colors working * fix outdate source ranges after drag problem * update moreNodePathFromSourceRange * fix ts-rs issue/workaround * fix default plane weirdness * fix tangential arc rounding issue * review clean up part 1 * review clean up part 2 Big state-diagram cull * clippy * typo * clippy * fix xstate types with typegen * fix types * clippy * catch error * fix test import issue Not sure exactly what was happening but guessing circular import that vite didn't like * add axis/plane info to sketch group tests * case changes because of rs-ts bug, can probably revert this later * start of playwright test fixes * reduce geo complexity for straight segments * fix cam adjust tests * Revert "Clean up vite build warnings (#1332)" This reverts commit c1f661ab5254458c3e9fdb396a31860a22c790f1. * selection e2e test fixed< * remove camToggle to allow playwright tests to pass * remove drag test too brittle and needs to be redone from the ground up anyway * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * fix last test * clean up part 3 * clean up part 4 * clean up part 5 * clean up sketch enter exit logic * fix engine side selections * default plane should not be selected form 'onDragEnd' i.e. rotating the camera should not mean the user acidently selects a plane * clean up state diagram around animating to sketch mode Embracing that the animation is async and puting the interdiate steps in the state diagram clean up some logic and solved some bugs at the same time * add test for multiple sketches * typo * make highlight more robust * type tweak * scale segmenst with distance from camera so they have a consistent pixel size/ screenspace size * Jess's advice * tsc and fmt * clean up part 6 remove integer from xstate names * clean up part 7 * integrate sequency in to camera moves * fix tests * update snapshot e2e * small snapshot change * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * trigger ci * Fix HomeLoaderData types * update std stuff * update kittycad rs client lib --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Frank Noirot <frank@kittycad.io> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-02-11 12:59:00 +11:00
},
}
}
export function handleSelectionBatch({
selections,
}: {
selections: Selections
}): {
SketchOnFace UI (#1664) * always enter edit mode * initial blocking of extra code-mirror updates * dry out code * rejig selections * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * clean up * stream clean up * update export * sketch mode can be entered and exited for extrude faces But has bugs * startSketchOn working in some cases, editsketch animation working but not orientation of instersection plane etc * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit 406fca4c553681fbad882167a9c1ab380af52899. * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * remove comment * add sketch on face e2e test * tweenCamToNegYAxis should respect reduced motion * initial sketch on face working with test * remove temporary toolbar button and xState flow * un-used vars * snapshot test tweak * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * type tidy up * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit c39b8ebf954fa63556e21da081031b8acd77c909. * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit fecf6f490af6ced34959653984108958fb504f82. * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * rename * sketch on sketch on sketch * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * typo * startSketchOn Endcaps end works, start is weird still * clear selections for entity_ids that are not recognised * fix sketch on end cap of second order extrustion * tiny clean up * fix sketch on close segment/face * clean up 'lastCodeMirrorSelectionUpdatedFromScene' * add code mode test for sketchOnExtrudedFace * make end cap selection more robust * update js artifacts for extrudes * update kcl docs * clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-22 10:23:04 +11:00
engineEvents: Models['WebSocketRequest_type'][]
codeMirrorSelection: EditorSelection
updateSceneObjectColors: () => void
} {
const ranges: ReturnType<typeof EditorSelection.cursor>[] = []
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
const selectionToEngine: SelectionToEngine[] = []
selections.graphSelections.forEach(({ artifact }) => {
artifact?.id &&
selectionToEngine.push({
id: artifact?.id,
range:
getCodeRefsByArtifactId(artifact.id, kclManager.artifactGraph)?.[0]
.range || defaultSourceRange(),
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
})
})
SketchOnFace UI (#1664) * always enter edit mode * initial blocking of extra code-mirror updates * dry out code * rejig selections * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * clean up * stream clean up * update export * sketch mode can be entered and exited for extrude faces But has bugs * startSketchOn working in some cases, editsketch animation working but not orientation of instersection plane etc * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit 406fca4c553681fbad882167a9c1ab380af52899. * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * remove comment * add sketch on face e2e test * tweenCamToNegYAxis should respect reduced motion * initial sketch on face working with test * remove temporary toolbar button and xState flow * un-used vars * snapshot test tweak * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * type tidy up * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit c39b8ebf954fa63556e21da081031b8acd77c909. * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit fecf6f490af6ced34959653984108958fb504f82. * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * rename * sketch on sketch on sketch * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * typo * startSketchOn Endcaps end works, start is weird still * clear selections for entity_ids that are not recognised * fix sketch on end cap of second order extrustion * tiny clean up * fix sketch on close segment/face * clean up 'lastCodeMirrorSelectionUpdatedFromScene' * add code mode test for sketchOnExtrudedFace * make end cap selection more robust * update js artifacts for extrudes * update kcl docs * clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-22 10:23:04 +11:00
const engineEvents: Models['WebSocketRequest_type'][] =
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
resetAndSetEngineEntitySelectionCmds(selectionToEngine)
selections.graphSelections.forEach(({ codeRef }) => {
if (codeRef.range?.[1]) {
const safeEnd = Math.min(codeRef.range[1], codeManager.code.length)
ranges.push(EditorSelection.cursor(safeEnd))
}
})
if (ranges.length)
return {
SketchOnFace UI (#1664) * always enter edit mode * initial blocking of extra code-mirror updates * dry out code * rejig selections * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * clean up * stream clean up * update export * sketch mode can be entered and exited for extrude faces But has bugs * startSketchOn working in some cases, editsketch animation working but not orientation of instersection plane etc * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit 406fca4c553681fbad882167a9c1ab380af52899. * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * remove comment * add sketch on face e2e test * tweenCamToNegYAxis should respect reduced motion * initial sketch on face working with test * remove temporary toolbar button and xState flow * un-used vars * snapshot test tweak * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * type tidy up * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit c39b8ebf954fa63556e21da081031b8acd77c909. * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit fecf6f490af6ced34959653984108958fb504f82. * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * rename * sketch on sketch on sketch * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * typo * startSketchOn Endcaps end works, start is weird still * clear selections for entity_ids that are not recognised * fix sketch on end cap of second order extrustion * tiny clean up * fix sketch on close segment/face * clean up 'lastCodeMirrorSelectionUpdatedFromScene' * add code mode test for sketchOnExtrudedFace * make end cap selection more robust * update js artifacts for extrudes * update kcl docs * clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-22 10:23:04 +11:00
engineEvents,
codeMirrorSelection: EditorSelection.create(
ranges,
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
selections.graphSelections.length - 1
),
SketchOnFace UI (#1664) * always enter edit mode * initial blocking of extra code-mirror updates * dry out code * rejig selections * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * clean up * stream clean up * update export * sketch mode can be entered and exited for extrude faces But has bugs * startSketchOn working in some cases, editsketch animation working but not orientation of instersection plane etc * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit 406fca4c553681fbad882167a9c1ab380af52899. * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * remove comment * add sketch on face e2e test * tweenCamToNegYAxis should respect reduced motion * initial sketch on face working with test * remove temporary toolbar button and xState flow * un-used vars * snapshot test tweak * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * type tidy up * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit c39b8ebf954fa63556e21da081031b8acd77c909. * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit fecf6f490af6ced34959653984108958fb504f82. * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * rename * sketch on sketch on sketch * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * typo * startSketchOn Endcaps end works, start is weird still * clear selections for entity_ids that are not recognised * fix sketch on end cap of second order extrustion * tiny clean up * fix sketch on close segment/face * clean up 'lastCodeMirrorSelectionUpdatedFromScene' * add code mode test for sketchOnExtrudedFace * make end cap selection more robust * update js artifacts for extrudes * update kcl docs * clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-22 10:23:04 +11:00
updateSceneObjectColors: () =>
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
updateSceneObjectColors(selections.graphSelections),
}
return {
SketchOnFace UI (#1664) * always enter edit mode * initial blocking of extra code-mirror updates * dry out code * rejig selections * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * clean up * stream clean up * update export * sketch mode can be entered and exited for extrude faces But has bugs * startSketchOn working in some cases, editsketch animation working but not orientation of instersection plane etc * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit 406fca4c553681fbad882167a9c1ab380af52899. * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * remove comment * add sketch on face e2e test * tweenCamToNegYAxis should respect reduced motion * initial sketch on face working with test * remove temporary toolbar button and xState flow * un-used vars * snapshot test tweak * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * type tidy up * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit c39b8ebf954fa63556e21da081031b8acd77c909. * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit fecf6f490af6ced34959653984108958fb504f82. * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * rename * sketch on sketch on sketch * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * typo * startSketchOn Endcaps end works, start is weird still * clear selections for entity_ids that are not recognised * fix sketch on end cap of second order extrustion * tiny clean up * fix sketch on close segment/face * clean up 'lastCodeMirrorSelectionUpdatedFromScene' * add code mode test for sketchOnExtrudedFace * make end cap selection more robust * update js artifacts for extrudes * update kcl docs * clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-22 10:23:04 +11:00
codeMirrorSelection: EditorSelection.create(
[EditorSelection.cursor(codeManager.code.length)],
SketchOnFace UI (#1664) * always enter edit mode * initial blocking of extra code-mirror updates * dry out code * rejig selections * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * clean up * stream clean up * update export * sketch mode can be entered and exited for extrude faces But has bugs * startSketchOn working in some cases, editsketch animation working but not orientation of instersection plane etc * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit 406fca4c553681fbad882167a9c1ab380af52899. * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * remove comment * add sketch on face e2e test * tweenCamToNegYAxis should respect reduced motion * initial sketch on face working with test * remove temporary toolbar button and xState flow * un-used vars * snapshot test tweak * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * type tidy up * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit c39b8ebf954fa63556e21da081031b8acd77c909. * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit fecf6f490af6ced34959653984108958fb504f82. * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * rename * sketch on sketch on sketch * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * typo * startSketchOn Endcaps end works, start is weird still * clear selections for entity_ids that are not recognised * fix sketch on end cap of second order extrustion * tiny clean up * fix sketch on close segment/face * clean up 'lastCodeMirrorSelectionUpdatedFromScene' * add code mode test for sketchOnExtrudedFace * make end cap selection more robust * update js artifacts for extrudes * update kcl docs * clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-22 10:23:04 +11:00
0
),
engineEvents,
updateSceneObjectColors: () =>
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
updateSceneObjectColors(selections.graphSelections),
}
}
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
type SelectionToEngine = {
id?: string
range: SourceRange
}
export function processCodeMirrorRanges({
codeMirrorRanges,
selectionRanges,
isShiftDown,
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
ast,
artifactGraph,
}: {
codeMirrorRanges: readonly SelectionRange[]
selectionRanges: Selections
isShiftDown: boolean
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
ast: Program
artifactGraph: ArtifactGraph
}): null | {
modelingEvent: ModelingMachineEvent
engineEvents: Models['WebSocketRequest_type'][]
} {
const isChange =
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
codeMirrorRanges.length !== selectionRanges?.graphSelections?.length ||
codeMirrorRanges.some(({ from, to }, i) => {
return (
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
from !== selectionRanges.graphSelections[i]?.codeRef?.range[0] ||
to !== selectionRanges.graphSelections[i]?.codeRef?.range[1]
)
})
if (!isChange) return null
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
const codeBasedSelections: Selections['graphSelections'] =
codeMirrorRanges.map(({ from, to }) => {
Rust artifact graph (#5068) * Start porting artifact graph creation to Rust * Add most of artifact graph creation * Add handling loft command from recent PR * Refactor artifact merge code so that it errors when a new artifact type is added * Add sweep subtype * Finish implementation of build artifact graph * Fix wasm.ts to use new combined generated ts-rs file * Fix Rust lints * Fix lints * Fix up replacement code * Add artifact graph to WASM outcome * Add artifact graph to simulation test output * Add new artifact graph output snapshots * Fix wall field and reduce unreachable code * Change field order for subtype * Change subtype to be determined from the request, like the TS * Fix plane sweep_id * Condense code * Change ID types to be properly optional * Change to favor the new ID, the same as TS * Fix to make error impossible * Rename artifact type tag values to match TS * Fix name of field on Cap * Update outputs * Change to use Rust source range * Update output snapshots * Add conversion to mermaid mind map and add to snapshot tests * Add new mermaid mind map output * Add flowchart * Remove raw artifact graph from tests * Remove JSON artifact graph output * Update output file with header * Update output after adding flowchart * Fix flowchart to not have duplicate edges, one in each direction * Fix not not output duplicate edges in flowcharts * Change flowchart edge style to be more obvious when a direction is missing * Update output after deduplication of edges * Fix not not skip sketch-on-face artifacts * Add docs * Fix edge iteration order to be stable * Update output after fixing order * Port TS artifactGraph.test.ts tests to simulation tests * Add grouping segments and solid2ds with their path * Update output flowcharts since grouping paths * Remove TS artifactGraph tests * Remove unused d3 dependencies * Fix to track loft ID on paths * Add command ID to error messages * Move artifact graph test code to a separate file since it's a large file * Reduce function visibility * Remove TS artifact graph code * Fix spelling error with serde * Add TODO for edge cut consumed ID * Add comment about mermaid edge rank * Fix mermaid flowchart edge cuts to appear as children of their edges * Update output since fixing flowchart order * Fix to always build the artifact graph even when there's a KCL error * Add artifact graph to error output * Change optional ID merge to match TS * Remove redundant SourceRange definition * Remove Rust-flavored default source range function * Add helper for source range creation * Update doc comment for the website * Update docs after doc comment change * Fix to save engine responses in execution cache * Remove unused import * Fix to not call WASM function before beforeAll callback is run * Remove more unused imports
2025-01-17 14:34:36 -05:00
const pathToNode = getNodePathFromSourceRange(
ast,
topLevelRange(from, to)
)
return {
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
codeRef: {
Rust artifact graph (#5068) * Start porting artifact graph creation to Rust * Add most of artifact graph creation * Add handling loft command from recent PR * Refactor artifact merge code so that it errors when a new artifact type is added * Add sweep subtype * Finish implementation of build artifact graph * Fix wasm.ts to use new combined generated ts-rs file * Fix Rust lints * Fix lints * Fix up replacement code * Add artifact graph to WASM outcome * Add artifact graph to simulation test output * Add new artifact graph output snapshots * Fix wall field and reduce unreachable code * Change field order for subtype * Change subtype to be determined from the request, like the TS * Fix plane sweep_id * Condense code * Change ID types to be properly optional * Change to favor the new ID, the same as TS * Fix to make error impossible * Rename artifact type tag values to match TS * Fix name of field on Cap * Update outputs * Change to use Rust source range * Update output snapshots * Add conversion to mermaid mind map and add to snapshot tests * Add new mermaid mind map output * Add flowchart * Remove raw artifact graph from tests * Remove JSON artifact graph output * Update output file with header * Update output after adding flowchart * Fix flowchart to not have duplicate edges, one in each direction * Fix not not output duplicate edges in flowcharts * Change flowchart edge style to be more obvious when a direction is missing * Update output after deduplication of edges * Fix not not skip sketch-on-face artifacts * Add docs * Fix edge iteration order to be stable * Update output after fixing order * Port TS artifactGraph.test.ts tests to simulation tests * Add grouping segments and solid2ds with their path * Update output flowcharts since grouping paths * Remove TS artifactGraph tests * Remove unused d3 dependencies * Fix to track loft ID on paths * Add command ID to error messages * Move artifact graph test code to a separate file since it's a large file * Reduce function visibility * Remove TS artifact graph code * Fix spelling error with serde * Add TODO for edge cut consumed ID * Add comment about mermaid edge rank * Fix mermaid flowchart edge cuts to appear as children of their edges * Update output since fixing flowchart order * Fix to always build the artifact graph even when there's a KCL error * Add artifact graph to error output * Change optional ID merge to match TS * Remove redundant SourceRange definition * Remove Rust-flavored default source range function * Add helper for source range creation * Update doc comment for the website * Update docs after doc comment change * Fix to save engine responses in execution cache * Remove unused import * Fix to not call WASM function before beforeAll callback is run * Remove more unused imports
2025-01-17 14:34:36 -05:00
range: topLevelRange(from, to),
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
pathToNode,
},
}
})
const idBasedSelections: SelectionToEngine[] = codeToIdSelections(
codeBasedSelections,
artifactGraph,
kclManager.artifactIndex
)
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
const selections: Selection[] = []
for (const { id, range } of idBasedSelections) {
if (!id) {
const pathToNode = getNodePathFromSourceRange(ast, range)
selections.push({
codeRef: {
range,
pathToNode,
},
})
continue
}
const artifact = artifactGraph.get(id)
const codeRefs = getCodeRefsByArtifactId(id, artifactGraph)
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
if (artifact && codeRefs) {
selections.push({ artifact, codeRef: codeRefs[0] })
} else if (codeRefs) {
selections.push({ codeRef: codeRefs[0] })
}
}
if (!selectionRanges) return null
Client sketch scene (#1271) * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * make tsc happ * better error msg * fix control point issue * basic code gen working for tangentialArc * partical fix for move with arcs * tangential arc move * fix * make eslint rules less annoying * inital refactor of some xstate stuff * more old tangential arc clean up stuff * more tweaks * add testing * tweak xstate inspect * temp remove test * update formating for less conflicts * fix state machine layout after merge * shrug, something weird with xstate typegen * renaming some xstate events * tweak numbers to make CI playwright happ * CI hacks * more CI hacks * more CI hacks * new hack strategy * run tests agian * make cmd bar less flaky * ci hacks * CI hacks * CI hacks * CI hacks * clean up * fix * still have constraint stuff to deal with * progress on move rules * update source ranges after no execute code-mod * typo * mvp working * hide show sketch overlay * match scaling * update arrow head style * animate line tool * bypass xstate for animations, much smoother * add new segment working with refactor needed for setup paper sketch * refactor setup paper sketch * tangantialArcTo drag animations working * tangential arc polish * cargo fmt * clippy * more clippy * mock canvas * last of clippy? * typo * more clippy stuff * move util function so they are shareable with typescript * migrate a bunch to rust and only rust * add arc center point for draft tangential ac * clippy tweak * delete uneeded test * Rough start to scaling arrow heads. The tangent arrow heads are basically nuked and replaced while the straight line sections are just rotated and repositioned, this means they miss out on updating scaling number after a screen size changes. Needs fixing * fix bug with tool tips * fix draft line start position Having drag the end of teh path before selecting a tooltip would result in the draft line starting where the path used to end, stale data * some progress with pan maybe * fmt * inital camera sync working For perspective camera at least * change three.js to use z-up * add grid * orthographic camera working with polish items TODO * fix zoom level when swapping camera * fix up camera/orbit changing on cam change (pan wasn't being respected) * tidy up * use orbit target instead of assuming scene center * dynamic fov working * animate orthographic to perspective and reverse * fix import * temp fix for batch commands * initial client side scene sketch working * remove hover log * FOV adjust fix * fix comment * tear down sketch and small tweaks * some progress with camera tweening * combine dollyZoom engine commands see https://github.com/KittyCAD/modeling-api/compare/kurt-perspective-settings?expand=1 and https://github.com/KittyCAD/engine/compare/kurt-perspective-settings?expand=1 * make tests happy (mocks) * fix tween to vertical/camera-up bug * tween to each axis with hacky solutions in there * fix startSketchOn planes * tidy startSketchOn * tweening okay for now I think * get sketching on default planes working * allow editing on all default planes * clean up enter and exit sketch logic * tidy * tidy * remove more default plane stuff * start of draft line * remove some annoying parts of the paper.js implementation * fix drag than equip line bug * comment * don't animate on skech tear down since it's used for draft line * remove more default plane shit * style draft line * refine dashed line * draft line set up and tear down mostly happy * add on click logic ready for draft lines * sketch mode with drag and draft mode working solidly now, straight segments only * default planes match colors, hover and select still TODO * hover and click logic working for default planes Now just need the code mode to fire to 'startSketchOn(...)' * select default planes * remove some logs * fix update infinite loop * start of orbitControls port to Franks control guards * hiding scenes at different times * scene hide on camera move should be respected by scroll zoom * basic hover working * Hook up user camera settings to ClientSideScene (#1334) * Refactor to not import utilities from Router.tsx * Stop tracking changes or formatting *.typegen.ts * Hook up cameraControls to ClientSideScene * Remove camera controls toggle from temp debug panel --------- Co-authored-by: Kurt Hutten Irev-Dev <k.hutten@protonmail.ch> * add select segment moves cursor * highlight segments yellow on hover * cursor ranges effect 2d line colors * fix constrainst i.e. make sure the sketch is rejiged * selecting nothing should remove selections * remove hardcoded strings * update get_tangential_arc_to_info rust util * initial drawing of tangential arcs in client scene * fix tangentialArc arrow head direction * correct userData types for tangential arcs * get tangential arc updates working Doesn't include draging the head of the tangential arc itself yet * spot of clean up * make selections work with tangential arcs * get draft tangential segment animated * fix initial click weirdness for adding new tangential line * couple tweaks * add grace pixels /threshold to raycast * redo arc dashes so that they spawn from the ccenter of the arc * fix multi drag bug * fmt * add temp solution for close * add default axis hover colors, still needs select logic * selection of axis works, just with out selection color * get axis selection colors working * fix outdate source ranges after drag problem * update moreNodePathFromSourceRange * fix ts-rs issue/workaround * fix default plane weirdness * fix tangential arc rounding issue * review clean up part 1 * review clean up part 2 Big state-diagram cull * clippy * typo * clippy * fix xstate types with typegen * fix types * clippy * catch error * fix test import issue Not sure exactly what was happening but guessing circular import that vite didn't like * add axis/plane info to sketch group tests * case changes because of rs-ts bug, can probably revert this later * start of playwright test fixes * reduce geo complexity for straight segments * fix cam adjust tests * Revert "Clean up vite build warnings (#1332)" This reverts commit c1f661ab5254458c3e9fdb396a31860a22c790f1. * selection e2e test fixed< * remove camToggle to allow playwright tests to pass * remove drag test too brittle and needs to be redone from the ground up anyway * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * fix last test * clean up part 3 * clean up part 4 * clean up part 5 * clean up sketch enter exit logic * fix engine side selections * default plane should not be selected form 'onDragEnd' i.e. rotating the camera should not mean the user acidently selects a plane * clean up state diagram around animating to sketch mode Embracing that the animation is async and puting the interdiate steps in the state diagram clean up some logic and solved some bugs at the same time * add test for multiple sketches * typo * make highlight more robust * type tweak * scale segmenst with distance from camera so they have a consistent pixel size/ screenspace size * Jess's advice * tsc and fmt * clean up part 6 remove integer from xstate names * clean up part 7 * integrate sequency in to camera moves * fix tests * update snapshot e2e * small snapshot change * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * trigger ci * Fix HomeLoaderData types * update std stuff * update kittycad rs client lib --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Frank Noirot <frank@kittycad.io> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-02-11 12:59:00 +11:00
updateSceneObjectColors(codeBasedSelections)
return {
modelingEvent: {
type: 'Set selection',
data: {
selectionType: 'mirrorCodeMirrorSelections',
selection: {
otherSelections: isShiftDown ? selectionRanges.otherSelections : [],
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
graphSelections: selections,
},
},
},
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
engineEvents: resetAndSetEngineEntitySelectionCmds(
idBasedSelections.filter(({ id }) => !!id)
),
}
}
function updateSceneObjectColors(codeBasedSelections: Selection[]) {
const updated = kclManager.ast
Object.values(sceneEntitiesManager.activeSegments).forEach((segmentGroup) => {
if (!SEGMENT_BODIES_PLUS_PROFILE_START.includes(segmentGroup?.name)) return
const nodeMeta = getNodeFromPath<Node<CallExpressionKw>>(
Client sketch scene (#1271) * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * make tsc happ * better error msg * fix control point issue * basic code gen working for tangentialArc * partical fix for move with arcs * tangential arc move * fix * make eslint rules less annoying * inital refactor of some xstate stuff * more old tangential arc clean up stuff * more tweaks * add testing * tweak xstate inspect * temp remove test * update formating for less conflicts * fix state machine layout after merge * shrug, something weird with xstate typegen * renaming some xstate events * tweak numbers to make CI playwright happ * CI hacks * more CI hacks * more CI hacks * new hack strategy * run tests agian * make cmd bar less flaky * ci hacks * CI hacks * CI hacks * CI hacks * clean up * fix * still have constraint stuff to deal with * progress on move rules * update source ranges after no execute code-mod * typo * mvp working * hide show sketch overlay * match scaling * update arrow head style * animate line tool * bypass xstate for animations, much smoother * add new segment working with refactor needed for setup paper sketch * refactor setup paper sketch * tangantialArcTo drag animations working * tangential arc polish * cargo fmt * clippy * more clippy * mock canvas * last of clippy? * typo * more clippy stuff * move util function so they are shareable with typescript * migrate a bunch to rust and only rust * add arc center point for draft tangential ac * clippy tweak * delete uneeded test * Rough start to scaling arrow heads. The tangent arrow heads are basically nuked and replaced while the straight line sections are just rotated and repositioned, this means they miss out on updating scaling number after a screen size changes. Needs fixing * fix bug with tool tips * fix draft line start position Having drag the end of teh path before selecting a tooltip would result in the draft line starting where the path used to end, stale data * some progress with pan maybe * fmt * inital camera sync working For perspective camera at least * change three.js to use z-up * add grid * orthographic camera working with polish items TODO * fix zoom level when swapping camera * fix up camera/orbit changing on cam change (pan wasn't being respected) * tidy up * use orbit target instead of assuming scene center * dynamic fov working * animate orthographic to perspective and reverse * fix import * temp fix for batch commands * initial client side scene sketch working * remove hover log * FOV adjust fix * fix comment * tear down sketch and small tweaks * some progress with camera tweening * combine dollyZoom engine commands see https://github.com/KittyCAD/modeling-api/compare/kurt-perspective-settings?expand=1 and https://github.com/KittyCAD/engine/compare/kurt-perspective-settings?expand=1 * make tests happy (mocks) * fix tween to vertical/camera-up bug * tween to each axis with hacky solutions in there * fix startSketchOn planes * tidy startSketchOn * tweening okay for now I think * get sketching on default planes working * allow editing on all default planes * clean up enter and exit sketch logic * tidy * tidy * remove more default plane stuff * start of draft line * remove some annoying parts of the paper.js implementation * fix drag than equip line bug * comment * don't animate on skech tear down since it's used for draft line * remove more default plane shit * style draft line * refine dashed line * draft line set up and tear down mostly happy * add on click logic ready for draft lines * sketch mode with drag and draft mode working solidly now, straight segments only * default planes match colors, hover and select still TODO * hover and click logic working for default planes Now just need the code mode to fire to 'startSketchOn(...)' * select default planes * remove some logs * fix update infinite loop * start of orbitControls port to Franks control guards * hiding scenes at different times * scene hide on camera move should be respected by scroll zoom * basic hover working * Hook up user camera settings to ClientSideScene (#1334) * Refactor to not import utilities from Router.tsx * Stop tracking changes or formatting *.typegen.ts * Hook up cameraControls to ClientSideScene * Remove camera controls toggle from temp debug panel --------- Co-authored-by: Kurt Hutten Irev-Dev <k.hutten@protonmail.ch> * add select segment moves cursor * highlight segments yellow on hover * cursor ranges effect 2d line colors * fix constrainst i.e. make sure the sketch is rejiged * selecting nothing should remove selections * remove hardcoded strings * update get_tangential_arc_to_info rust util * initial drawing of tangential arcs in client scene * fix tangentialArc arrow head direction * correct userData types for tangential arcs * get tangential arc updates working Doesn't include draging the head of the tangential arc itself yet * spot of clean up * make selections work with tangential arcs * get draft tangential segment animated * fix initial click weirdness for adding new tangential line * couple tweaks * add grace pixels /threshold to raycast * redo arc dashes so that they spawn from the ccenter of the arc * fix multi drag bug * fmt * add temp solution for close * add default axis hover colors, still needs select logic * selection of axis works, just with out selection color * get axis selection colors working * fix outdate source ranges after drag problem * update moreNodePathFromSourceRange * fix ts-rs issue/workaround * fix default plane weirdness * fix tangential arc rounding issue * review clean up part 1 * review clean up part 2 Big state-diagram cull * clippy * typo * clippy * fix xstate types with typegen * fix types * clippy * catch error * fix test import issue Not sure exactly what was happening but guessing circular import that vite didn't like * add axis/plane info to sketch group tests * case changes because of rs-ts bug, can probably revert this later * start of playwright test fixes * reduce geo complexity for straight segments * fix cam adjust tests * Revert "Clean up vite build warnings (#1332)" This reverts commit c1f661ab5254458c3e9fdb396a31860a22c790f1. * selection e2e test fixed< * remove camToggle to allow playwright tests to pass * remove drag test too brittle and needs to be redone from the ground up anyway * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * fix last test * clean up part 3 * clean up part 4 * clean up part 5 * clean up sketch enter exit logic * fix engine side selections * default plane should not be selected form 'onDragEnd' i.e. rotating the camera should not mean the user acidently selects a plane * clean up state diagram around animating to sketch mode Embracing that the animation is async and puting the interdiate steps in the state diagram clean up some logic and solved some bugs at the same time * add test for multiple sketches * typo * make highlight more robust * type tweak * scale segmenst with distance from camera so they have a consistent pixel size/ screenspace size * Jess's advice * tsc and fmt * clean up part 6 remove integer from xstate names * clean up part 7 * integrate sequency in to camera moves * fix tests * update snapshot e2e * small snapshot change * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * trigger ci * Fix HomeLoaderData types * update std stuff * update kittycad rs client lib --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Frank Noirot <frank@kittycad.io> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-02-11 12:59:00 +11:00
updated,
segmentGroup.userData.pathToNode,
['CallExpressionKw']
)
if (err(nodeMeta)) return
const node = nodeMeta.node
Client sketch scene (#1271) * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * make tsc happ * better error msg * fix control point issue * basic code gen working for tangentialArc * partical fix for move with arcs * tangential arc move * fix * make eslint rules less annoying * inital refactor of some xstate stuff * more old tangential arc clean up stuff * more tweaks * add testing * tweak xstate inspect * temp remove test * update formating for less conflicts * fix state machine layout after merge * shrug, something weird with xstate typegen * renaming some xstate events * tweak numbers to make CI playwright happ * CI hacks * more CI hacks * more CI hacks * new hack strategy * run tests agian * make cmd bar less flaky * ci hacks * CI hacks * CI hacks * CI hacks * clean up * fix * still have constraint stuff to deal with * progress on move rules * update source ranges after no execute code-mod * typo * mvp working * hide show sketch overlay * match scaling * update arrow head style * animate line tool * bypass xstate for animations, much smoother * add new segment working with refactor needed for setup paper sketch * refactor setup paper sketch * tangantialArcTo drag animations working * tangential arc polish * cargo fmt * clippy * more clippy * mock canvas * last of clippy? * typo * more clippy stuff * move util function so they are shareable with typescript * migrate a bunch to rust and only rust * add arc center point for draft tangential ac * clippy tweak * delete uneeded test * Rough start to scaling arrow heads. The tangent arrow heads are basically nuked and replaced while the straight line sections are just rotated and repositioned, this means they miss out on updating scaling number after a screen size changes. Needs fixing * fix bug with tool tips * fix draft line start position Having drag the end of teh path before selecting a tooltip would result in the draft line starting where the path used to end, stale data * some progress with pan maybe * fmt * inital camera sync working For perspective camera at least * change three.js to use z-up * add grid * orthographic camera working with polish items TODO * fix zoom level when swapping camera * fix up camera/orbit changing on cam change (pan wasn't being respected) * tidy up * use orbit target instead of assuming scene center * dynamic fov working * animate orthographic to perspective and reverse * fix import * temp fix for batch commands * initial client side scene sketch working * remove hover log * FOV adjust fix * fix comment * tear down sketch and small tweaks * some progress with camera tweening * combine dollyZoom engine commands see https://github.com/KittyCAD/modeling-api/compare/kurt-perspective-settings?expand=1 and https://github.com/KittyCAD/engine/compare/kurt-perspective-settings?expand=1 * make tests happy (mocks) * fix tween to vertical/camera-up bug * tween to each axis with hacky solutions in there * fix startSketchOn planes * tidy startSketchOn * tweening okay for now I think * get sketching on default planes working * allow editing on all default planes * clean up enter and exit sketch logic * tidy * tidy * remove more default plane stuff * start of draft line * remove some annoying parts of the paper.js implementation * fix drag than equip line bug * comment * don't animate on skech tear down since it's used for draft line * remove more default plane shit * style draft line * refine dashed line * draft line set up and tear down mostly happy * add on click logic ready for draft lines * sketch mode with drag and draft mode working solidly now, straight segments only * default planes match colors, hover and select still TODO * hover and click logic working for default planes Now just need the code mode to fire to 'startSketchOn(...)' * select default planes * remove some logs * fix update infinite loop * start of orbitControls port to Franks control guards * hiding scenes at different times * scene hide on camera move should be respected by scroll zoom * basic hover working * Hook up user camera settings to ClientSideScene (#1334) * Refactor to not import utilities from Router.tsx * Stop tracking changes or formatting *.typegen.ts * Hook up cameraControls to ClientSideScene * Remove camera controls toggle from temp debug panel --------- Co-authored-by: Kurt Hutten Irev-Dev <k.hutten@protonmail.ch> * add select segment moves cursor * highlight segments yellow on hover * cursor ranges effect 2d line colors * fix constrainst i.e. make sure the sketch is rejiged * selecting nothing should remove selections * remove hardcoded strings * update get_tangential_arc_to_info rust util * initial drawing of tangential arcs in client scene * fix tangentialArc arrow head direction * correct userData types for tangential arcs * get tangential arc updates working Doesn't include draging the head of the tangential arc itself yet * spot of clean up * make selections work with tangential arcs * get draft tangential segment animated * fix initial click weirdness for adding new tangential line * couple tweaks * add grace pixels /threshold to raycast * redo arc dashes so that they spawn from the ccenter of the arc * fix multi drag bug * fmt * add temp solution for close * add default axis hover colors, still needs select logic * selection of axis works, just with out selection color * get axis selection colors working * fix outdate source ranges after drag problem * update moreNodePathFromSourceRange * fix ts-rs issue/workaround * fix default plane weirdness * fix tangential arc rounding issue * review clean up part 1 * review clean up part 2 Big state-diagram cull * clippy * typo * clippy * fix xstate types with typegen * fix types * clippy * catch error * fix test import issue Not sure exactly what was happening but guessing circular import that vite didn't like * add axis/plane info to sketch group tests * case changes because of rs-ts bug, can probably revert this later * start of playwright test fixes * reduce geo complexity for straight segments * fix cam adjust tests * Revert "Clean up vite build warnings (#1332)" This reverts commit c1f661ab5254458c3e9fdb396a31860a22c790f1. * selection e2e test fixed< * remove camToggle to allow playwright tests to pass * remove drag test too brittle and needs to be redone from the ground up anyway * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * fix last test * clean up part 3 * clean up part 4 * clean up part 5 * clean up sketch enter exit logic * fix engine side selections * default plane should not be selected form 'onDragEnd' i.e. rotating the camera should not mean the user acidently selects a plane * clean up state diagram around animating to sketch mode Embracing that the animation is async and puting the interdiate steps in the state diagram clean up some logic and solved some bugs at the same time * add test for multiple sketches * typo * make highlight more robust * type tweak * scale segmenst with distance from camera so they have a consistent pixel size/ screenspace size * Jess's advice * tsc and fmt * clean up part 6 remove integer from xstate names * clean up part 7 * integrate sequency in to camera moves * fix tests * update snapshot e2e * small snapshot change * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * trigger ci * Fix HomeLoaderData types * update std stuff * update kittycad rs client lib --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Frank Noirot <frank@kittycad.io> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-02-11 12:59:00 +11:00
const groupHasCursor = codeBasedSelections.some((selection) => {
Rust artifact graph (#5068) * Start porting artifact graph creation to Rust * Add most of artifact graph creation * Add handling loft command from recent PR * Refactor artifact merge code so that it errors when a new artifact type is added * Add sweep subtype * Finish implementation of build artifact graph * Fix wasm.ts to use new combined generated ts-rs file * Fix Rust lints * Fix lints * Fix up replacement code * Add artifact graph to WASM outcome * Add artifact graph to simulation test output * Add new artifact graph output snapshots * Fix wall field and reduce unreachable code * Change field order for subtype * Change subtype to be determined from the request, like the TS * Fix plane sweep_id * Condense code * Change ID types to be properly optional * Change to favor the new ID, the same as TS * Fix to make error impossible * Rename artifact type tag values to match TS * Fix name of field on Cap * Update outputs * Change to use Rust source range * Update output snapshots * Add conversion to mermaid mind map and add to snapshot tests * Add new mermaid mind map output * Add flowchart * Remove raw artifact graph from tests * Remove JSON artifact graph output * Update output file with header * Update output after adding flowchart * Fix flowchart to not have duplicate edges, one in each direction * Fix not not output duplicate edges in flowcharts * Change flowchart edge style to be more obvious when a direction is missing * Update output after deduplication of edges * Fix not not skip sketch-on-face artifacts * Add docs * Fix edge iteration order to be stable * Update output after fixing order * Port TS artifactGraph.test.ts tests to simulation tests * Add grouping segments and solid2ds with their path * Update output flowcharts since grouping paths * Remove TS artifactGraph tests * Remove unused d3 dependencies * Fix to track loft ID on paths * Add command ID to error messages * Move artifact graph test code to a separate file since it's a large file * Reduce function visibility * Remove TS artifact graph code * Fix spelling error with serde * Add TODO for edge cut consumed ID * Add comment about mermaid edge rank * Fix mermaid flowchart edge cuts to appear as children of their edges * Update output since fixing flowchart order * Fix to always build the artifact graph even when there's a KCL error * Add artifact graph to error output * Change optional ID merge to match TS * Remove redundant SourceRange definition * Remove Rust-flavored default source range function * Add helper for source range creation * Update doc comment for the website * Update docs after doc comment change * Fix to save engine responses in execution cache * Remove unused import * Fix to not call WASM function before beforeAll callback is run * Remove more unused imports
2025-01-17 14:34:36 -05:00
return isOverlap(
selection?.codeRef?.range,
topLevelRange(node.start, node.end)
)
Client sketch scene (#1271) * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * make tsc happ * better error msg * fix control point issue * basic code gen working for tangentialArc * partical fix for move with arcs * tangential arc move * fix * make eslint rules less annoying * inital refactor of some xstate stuff * more old tangential arc clean up stuff * more tweaks * add testing * tweak xstate inspect * temp remove test * update formating for less conflicts * fix state machine layout after merge * shrug, something weird with xstate typegen * renaming some xstate events * tweak numbers to make CI playwright happ * CI hacks * more CI hacks * more CI hacks * new hack strategy * run tests agian * make cmd bar less flaky * ci hacks * CI hacks * CI hacks * CI hacks * clean up * fix * still have constraint stuff to deal with * progress on move rules * update source ranges after no execute code-mod * typo * mvp working * hide show sketch overlay * match scaling * update arrow head style * animate line tool * bypass xstate for animations, much smoother * add new segment working with refactor needed for setup paper sketch * refactor setup paper sketch * tangantialArcTo drag animations working * tangential arc polish * cargo fmt * clippy * more clippy * mock canvas * last of clippy? * typo * more clippy stuff * move util function so they are shareable with typescript * migrate a bunch to rust and only rust * add arc center point for draft tangential ac * clippy tweak * delete uneeded test * Rough start to scaling arrow heads. The tangent arrow heads are basically nuked and replaced while the straight line sections are just rotated and repositioned, this means they miss out on updating scaling number after a screen size changes. Needs fixing * fix bug with tool tips * fix draft line start position Having drag the end of teh path before selecting a tooltip would result in the draft line starting where the path used to end, stale data * some progress with pan maybe * fmt * inital camera sync working For perspective camera at least * change three.js to use z-up * add grid * orthographic camera working with polish items TODO * fix zoom level when swapping camera * fix up camera/orbit changing on cam change (pan wasn't being respected) * tidy up * use orbit target instead of assuming scene center * dynamic fov working * animate orthographic to perspective and reverse * fix import * temp fix for batch commands * initial client side scene sketch working * remove hover log * FOV adjust fix * fix comment * tear down sketch and small tweaks * some progress with camera tweening * combine dollyZoom engine commands see https://github.com/KittyCAD/modeling-api/compare/kurt-perspective-settings?expand=1 and https://github.com/KittyCAD/engine/compare/kurt-perspective-settings?expand=1 * make tests happy (mocks) * fix tween to vertical/camera-up bug * tween to each axis with hacky solutions in there * fix startSketchOn planes * tidy startSketchOn * tweening okay for now I think * get sketching on default planes working * allow editing on all default planes * clean up enter and exit sketch logic * tidy * tidy * remove more default plane stuff * start of draft line * remove some annoying parts of the paper.js implementation * fix drag than equip line bug * comment * don't animate on skech tear down since it's used for draft line * remove more default plane shit * style draft line * refine dashed line * draft line set up and tear down mostly happy * add on click logic ready for draft lines * sketch mode with drag and draft mode working solidly now, straight segments only * default planes match colors, hover and select still TODO * hover and click logic working for default planes Now just need the code mode to fire to 'startSketchOn(...)' * select default planes * remove some logs * fix update infinite loop * start of orbitControls port to Franks control guards * hiding scenes at different times * scene hide on camera move should be respected by scroll zoom * basic hover working * Hook up user camera settings to ClientSideScene (#1334) * Refactor to not import utilities from Router.tsx * Stop tracking changes or formatting *.typegen.ts * Hook up cameraControls to ClientSideScene * Remove camera controls toggle from temp debug panel --------- Co-authored-by: Kurt Hutten Irev-Dev <k.hutten@protonmail.ch> * add select segment moves cursor * highlight segments yellow on hover * cursor ranges effect 2d line colors * fix constrainst i.e. make sure the sketch is rejiged * selecting nothing should remove selections * remove hardcoded strings * update get_tangential_arc_to_info rust util * initial drawing of tangential arcs in client scene * fix tangentialArc arrow head direction * correct userData types for tangential arcs * get tangential arc updates working Doesn't include draging the head of the tangential arc itself yet * spot of clean up * make selections work with tangential arcs * get draft tangential segment animated * fix initial click weirdness for adding new tangential line * couple tweaks * add grace pixels /threshold to raycast * redo arc dashes so that they spawn from the ccenter of the arc * fix multi drag bug * fmt * add temp solution for close * add default axis hover colors, still needs select logic * selection of axis works, just with out selection color * get axis selection colors working * fix outdate source ranges after drag problem * update moreNodePathFromSourceRange * fix ts-rs issue/workaround * fix default plane weirdness * fix tangential arc rounding issue * review clean up part 1 * review clean up part 2 Big state-diagram cull * clippy * typo * clippy * fix xstate types with typegen * fix types * clippy * catch error * fix test import issue Not sure exactly what was happening but guessing circular import that vite didn't like * add axis/plane info to sketch group tests * case changes because of rs-ts bug, can probably revert this later * start of playwright test fixes * reduce geo complexity for straight segments * fix cam adjust tests * Revert "Clean up vite build warnings (#1332)" This reverts commit c1f661ab5254458c3e9fdb396a31860a22c790f1. * selection e2e test fixed< * remove camToggle to allow playwright tests to pass * remove drag test too brittle and needs to be redone from the ground up anyway * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * fix last test * clean up part 3 * clean up part 4 * clean up part 5 * clean up sketch enter exit logic * fix engine side selections * default plane should not be selected form 'onDragEnd' i.e. rotating the camera should not mean the user acidently selects a plane * clean up state diagram around animating to sketch mode Embracing that the animation is async and puting the interdiate steps in the state diagram clean up some logic and solved some bugs at the same time * add test for multiple sketches * typo * make highlight more robust * type tweak * scale segmenst with distance from camera so they have a consistent pixel size/ screenspace size * Jess's advice * tsc and fmt * clean up part 6 remove integer from xstate names * clean up part 7 * integrate sequency in to camera moves * fix tests * update snapshot e2e * small snapshot change * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * trigger ci * Fix HomeLoaderData types * update std stuff * update kittycad rs client lib --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Frank Noirot <frank@kittycad.io> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-02-11 12:59:00 +11:00
})
const color = groupHasCursor
? 0x0000ff
: segmentGroup?.userData?.baseColor || 0xffffff
Client sketch scene (#1271) * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * make tsc happ * better error msg * fix control point issue * basic code gen working for tangentialArc * partical fix for move with arcs * tangential arc move * fix * make eslint rules less annoying * inital refactor of some xstate stuff * more old tangential arc clean up stuff * more tweaks * add testing * tweak xstate inspect * temp remove test * update formating for less conflicts * fix state machine layout after merge * shrug, something weird with xstate typegen * renaming some xstate events * tweak numbers to make CI playwright happ * CI hacks * more CI hacks * more CI hacks * new hack strategy * run tests agian * make cmd bar less flaky * ci hacks * CI hacks * CI hacks * CI hacks * clean up * fix * still have constraint stuff to deal with * progress on move rules * update source ranges after no execute code-mod * typo * mvp working * hide show sketch overlay * match scaling * update arrow head style * animate line tool * bypass xstate for animations, much smoother * add new segment working with refactor needed for setup paper sketch * refactor setup paper sketch * tangantialArcTo drag animations working * tangential arc polish * cargo fmt * clippy * more clippy * mock canvas * last of clippy? * typo * more clippy stuff * move util function so they are shareable with typescript * migrate a bunch to rust and only rust * add arc center point for draft tangential ac * clippy tweak * delete uneeded test * Rough start to scaling arrow heads. The tangent arrow heads are basically nuked and replaced while the straight line sections are just rotated and repositioned, this means they miss out on updating scaling number after a screen size changes. Needs fixing * fix bug with tool tips * fix draft line start position Having drag the end of teh path before selecting a tooltip would result in the draft line starting where the path used to end, stale data * some progress with pan maybe * fmt * inital camera sync working For perspective camera at least * change three.js to use z-up * add grid * orthographic camera working with polish items TODO * fix zoom level when swapping camera * fix up camera/orbit changing on cam change (pan wasn't being respected) * tidy up * use orbit target instead of assuming scene center * dynamic fov working * animate orthographic to perspective and reverse * fix import * temp fix for batch commands * initial client side scene sketch working * remove hover log * FOV adjust fix * fix comment * tear down sketch and small tweaks * some progress with camera tweening * combine dollyZoom engine commands see https://github.com/KittyCAD/modeling-api/compare/kurt-perspective-settings?expand=1 and https://github.com/KittyCAD/engine/compare/kurt-perspective-settings?expand=1 * make tests happy (mocks) * fix tween to vertical/camera-up bug * tween to each axis with hacky solutions in there * fix startSketchOn planes * tidy startSketchOn * tweening okay for now I think * get sketching on default planes working * allow editing on all default planes * clean up enter and exit sketch logic * tidy * tidy * remove more default plane stuff * start of draft line * remove some annoying parts of the paper.js implementation * fix drag than equip line bug * comment * don't animate on skech tear down since it's used for draft line * remove more default plane shit * style draft line * refine dashed line * draft line set up and tear down mostly happy * add on click logic ready for draft lines * sketch mode with drag and draft mode working solidly now, straight segments only * default planes match colors, hover and select still TODO * hover and click logic working for default planes Now just need the code mode to fire to 'startSketchOn(...)' * select default planes * remove some logs * fix update infinite loop * start of orbitControls port to Franks control guards * hiding scenes at different times * scene hide on camera move should be respected by scroll zoom * basic hover working * Hook up user camera settings to ClientSideScene (#1334) * Refactor to not import utilities from Router.tsx * Stop tracking changes or formatting *.typegen.ts * Hook up cameraControls to ClientSideScene * Remove camera controls toggle from temp debug panel --------- Co-authored-by: Kurt Hutten Irev-Dev <k.hutten@protonmail.ch> * add select segment moves cursor * highlight segments yellow on hover * cursor ranges effect 2d line colors * fix constrainst i.e. make sure the sketch is rejiged * selecting nothing should remove selections * remove hardcoded strings * update get_tangential_arc_to_info rust util * initial drawing of tangential arcs in client scene * fix tangentialArc arrow head direction * correct userData types for tangential arcs * get tangential arc updates working Doesn't include draging the head of the tangential arc itself yet * spot of clean up * make selections work with tangential arcs * get draft tangential segment animated * fix initial click weirdness for adding new tangential line * couple tweaks * add grace pixels /threshold to raycast * redo arc dashes so that they spawn from the ccenter of the arc * fix multi drag bug * fmt * add temp solution for close * add default axis hover colors, still needs select logic * selection of axis works, just with out selection color * get axis selection colors working * fix outdate source ranges after drag problem * update moreNodePathFromSourceRange * fix ts-rs issue/workaround * fix default plane weirdness * fix tangential arc rounding issue * review clean up part 1 * review clean up part 2 Big state-diagram cull * clippy * typo * clippy * fix xstate types with typegen * fix types * clippy * catch error * fix test import issue Not sure exactly what was happening but guessing circular import that vite didn't like * add axis/plane info to sketch group tests * case changes because of rs-ts bug, can probably revert this later * start of playwright test fixes * reduce geo complexity for straight segments * fix cam adjust tests * Revert "Clean up vite build warnings (#1332)" This reverts commit c1f661ab5254458c3e9fdb396a31860a22c790f1. * selection e2e test fixed< * remove camToggle to allow playwright tests to pass * remove drag test too brittle and needs to be redone from the ground up anyway * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * fix last test * clean up part 3 * clean up part 4 * clean up part 5 * clean up sketch enter exit logic * fix engine side selections * default plane should not be selected form 'onDragEnd' i.e. rotating the camera should not mean the user acidently selects a plane * clean up state diagram around animating to sketch mode Embracing that the animation is async and puting the interdiate steps in the state diagram clean up some logic and solved some bugs at the same time * add test for multiple sketches * typo * make highlight more robust * type tweak * scale segmenst with distance from camera so they have a consistent pixel size/ screenspace size * Jess's advice * tsc and fmt * clean up part 6 remove integer from xstate names * clean up part 7 * integrate sequency in to camera moves * fix tests * update snapshot e2e * small snapshot change * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * trigger ci * Fix HomeLoaderData types * update std stuff * update kittycad rs client lib --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Frank Noirot <frank@kittycad.io> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-02-11 12:59:00 +11:00
segmentGroup.traverse(
(child) => child instanceof Mesh && child.material.color.set(color)
)
// TODO if we had access to the xstate context and therefore selections
// we wouldn't need to set this here,
// it would be better to treat xstate context as the source of truth instead of having
// extra redundant state floating around
segmentGroup.userData.isSelected = groupHasCursor
})
}
function resetAndSetEngineEntitySelectionCmds(
selections: SelectionToEngine[]
): Models['WebSocketRequest_type'][] {
if (!engineCommandManager.engineConnection?.isReady()) {
return []
}
return [
{
type: 'modeling_cmd_req',
cmd: {
type: 'select_clear',
},
cmd_id: uuidv4(),
},
{
type: 'modeling_cmd_req',
cmd: {
type: 'select_add',
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
entities: selections.map(({ id }) => id).filter(isNonNullable),
},
cmd_id: uuidv4(),
},
]
}
Command bar: add extrude command, nonlinear editing, etc (#1204) * Tweak toaster look and feel * Add icons, tweak plus icon names * Rename commandBarMeta to commandBarConfig * Refactor command bar, add support for icons * Create a tailwind plugin for aria-pressed button state * Remove overlay from behind command bar * Clean up toolbar * Button and other style tweaks * Icon tweaks follow-up: make old icons work with new sizing * Delete unused static icons * More CSS tweaks * Small CSS tweak to project sidebar * Add command bar E2E test * fumpt * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * fix typo in a comment * Fix icon padding (built version only) * Update onboarding and warning banner icons padding * Misc minor style fixes * Get Extrude opening and canceling from command bar * Iconography tweaks * Get extrude kind of working * Refactor command bar config types and organization * Move command bar configs to be co-located with each other * Start building a state machine for the command bar * Start converting command bar to state machine * Add support for multiple args, confirmation step * Submission behavior, hotkeys, code organization * Add new test for extruding from command bar * Polish step back and selection hotkeys, CSS tweaks * Loading style tweaks * Validate selection inputs, polish UX of args re-editing * Prevent submission with multiple selection on singlular arg * Remove stray console logs * Tweak test, CSS nit, remove extrude "result" argument * Fix linting warnings * Show Ctrl+/ instead of ⌘K on all platforms but Mac * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * Add "Enter sketch" to command bar * fix command bar test * Fix flaky cmd bar extrude test by waiting for engine select response * Cover both button labels '⌘K' and 'Ctrl+/' in test --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
Remove guards from modeling commands in the toolbar (#4800) * Remove guards from modeling commands in the toolbar * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Remove the deprecated function, update doc comment for the one still in use * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Remove more selection check functions that are no longer used * Update E2E tests that assumed the extrude button could be disabled due to selection * Update a few fillet tests that expected the button to disable based on selection * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-16-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-macos-8-cores) * Trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-16-cores) * Trigger CI --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Pierre Jacquier <pierre@zoo.dev>
2024-12-19 18:42:39 -05:00
/**
* Is the selection a single cursor in a sketch pipe expression chain?
*/
Command bar: add extrude command, nonlinear editing, etc (#1204) * Tweak toaster look and feel * Add icons, tweak plus icon names * Rename commandBarMeta to commandBarConfig * Refactor command bar, add support for icons * Create a tailwind plugin for aria-pressed button state * Remove overlay from behind command bar * Clean up toolbar * Button and other style tweaks * Icon tweaks follow-up: make old icons work with new sizing * Delete unused static icons * More CSS tweaks * Small CSS tweak to project sidebar * Add command bar E2E test * fumpt * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * fix typo in a comment * Fix icon padding (built version only) * Update onboarding and warning banner icons padding * Misc minor style fixes * Get Extrude opening and canceling from command bar * Iconography tweaks * Get extrude kind of working * Refactor command bar config types and organization * Move command bar configs to be co-located with each other * Start building a state machine for the command bar * Start converting command bar to state machine * Add support for multiple args, confirmation step * Submission behavior, hotkeys, code organization * Add new test for extruding from command bar * Polish step back and selection hotkeys, CSS tweaks * Loading style tweaks * Validate selection inputs, polish UX of args re-editing * Prevent submission with multiple selection on singlular arg * Remove stray console logs * Tweak test, CSS nit, remove extrude "result" argument * Fix linting warnings * Show Ctrl+/ instead of ⌘K on all platforms but Mac * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * Add "Enter sketch" to command bar * fix command bar test * Fix flaky cmd bar extrude test by waiting for engine select response * Cover both button labels '⌘K' and 'Ctrl+/' in test --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
export function isSketchPipe(selectionRanges: Selections) {
if (!isSingleCursorInPipe(selectionRanges, kclManager.ast)) return false
return isCursorInSketchCommandRange(kclManager.artifactGraph, selectionRanges)
Command bar: add extrude command, nonlinear editing, etc (#1204) * Tweak toaster look and feel * Add icons, tweak plus icon names * Rename commandBarMeta to commandBarConfig * Refactor command bar, add support for icons * Create a tailwind plugin for aria-pressed button state * Remove overlay from behind command bar * Clean up toolbar * Button and other style tweaks * Icon tweaks follow-up: make old icons work with new sizing * Delete unused static icons * More CSS tweaks * Small CSS tweak to project sidebar * Add command bar E2E test * fumpt * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * fix typo in a comment * Fix icon padding (built version only) * Update onboarding and warning banner icons padding * Misc minor style fixes * Get Extrude opening and canceling from command bar * Iconography tweaks * Get extrude kind of working * Refactor command bar config types and organization * Move command bar configs to be co-located with each other * Start building a state machine for the command bar * Start converting command bar to state machine * Add support for multiple args, confirmation step * Submission behavior, hotkeys, code organization * Add new test for extruding from command bar * Polish step back and selection hotkeys, CSS tweaks * Loading style tweaks * Validate selection inputs, polish UX of args re-editing * Prevent submission with multiple selection on singlular arg * Remove stray console logs * Tweak test, CSS nit, remove extrude "result" argument * Fix linting warnings * Show Ctrl+/ instead of ⌘K on all platforms but Mac * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * Add "Enter sketch" to command bar * fix command bar test * Fix flaky cmd bar extrude test by waiting for engine select response * Cover both button labels '⌘K' and 'Ctrl+/' in test --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
}
// This accounts for non-geometry selections under "other"
export type ResolvedSelectionType = Artifact['type'] | 'other'
export type SelectionCountsByType = Map<ResolvedSelectionType, number>
Command bar: add extrude command, nonlinear editing, etc (#1204) * Tweak toaster look and feel * Add icons, tweak plus icon names * Rename commandBarMeta to commandBarConfig * Refactor command bar, add support for icons * Create a tailwind plugin for aria-pressed button state * Remove overlay from behind command bar * Clean up toolbar * Button and other style tweaks * Icon tweaks follow-up: make old icons work with new sizing * Delete unused static icons * More CSS tweaks * Small CSS tweak to project sidebar * Add command bar E2E test * fumpt * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * fix typo in a comment * Fix icon padding (built version only) * Update onboarding and warning banner icons padding * Misc minor style fixes * Get Extrude opening and canceling from command bar * Iconography tweaks * Get extrude kind of working * Refactor command bar config types and organization * Move command bar configs to be co-located with each other * Start building a state machine for the command bar * Start converting command bar to state machine * Add support for multiple args, confirmation step * Submission behavior, hotkeys, code organization * Add new test for extruding from command bar * Polish step back and selection hotkeys, CSS tweaks * Loading style tweaks * Validate selection inputs, polish UX of args re-editing * Prevent submission with multiple selection on singlular arg * Remove stray console logs * Tweak test, CSS nit, remove extrude "result" argument * Fix linting warnings * Show Ctrl+/ instead of ⌘K on all platforms but Mac * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * Add "Enter sketch" to command bar * fix command bar test * Fix flaky cmd bar extrude test by waiting for engine select response * Cover both button labels '⌘K' and 'Ctrl+/' in test --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
/**
* In the future, I'd like this function to properly return the type of each selected entity based on
* its code source range, so that we can show something like "0 objects" or "1 face" or "1 line, 2 edges",
* and then validate the selection in CommandBarSelectionInput.tsx and show the proper label.
* @param selection
* @returns
*/
export function getSelectionCountByType(
selection?: Selections
): SelectionCountsByType | 'none' {
const selectionsByType: SelectionCountsByType = new Map()
if (
!selection ||
(!selection.graphSelections.length && !selection.otherSelections.length)
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
)
return 'none'
function incrementOrInitializeSelectionType(type: ResolvedSelectionType) {
const count = selectionsByType.get(type) || 0
selectionsByType.set(type, count + 1)
}
selection.otherSelections.forEach((selection) => {
if (typeof selection === 'string') {
incrementOrInitializeSelectionType('other')
} else if ('name' in selection) {
incrementOrInitializeSelectionType('plane')
}
})
Move `length` and `named value` constraint flows into command palette (#4675) * Extend KCL argument input * Migrate length constraint to be a command * Add ability for `kcl` arguments to provide an initial variable name * Move named variable flow into command palette * Fix one e2e test * Remove unwanted `ZERO` behavior when length constraint has no `variableName` * Fix issue with `getSelectionCountByType` with sketches not yet in artifactGraph * Update broken constraint tests * Look at this (photo)Graph *in the voice of Nickelback* * Fix segment overlays tests, which had out-of-date selectors * Return early from `useConvertToVariable` if no selectionRanges * Fixup for review comment from #4677 (#4696) Signed-off-by: Nick Cameron <nrc@ncameron.org> * Invalidate nightly bucket files after publish (#4627) * Invalidate nightly bucket files after publish * Fix conflict resolution * Add some more warnings (#4697) * Add installation instructions for all platforms (#4592) * Add installation instructions for all platforms Fixes #4511 * Typo * Typo2 * Improve linux instructions, thanks @TomPridham Co-authored-by: Tom Pridham <pridham.tom@gmail.com> --------- Co-authored-by: Tom Pridham <pridham.tom@gmail.com> * Bump node to v22.12.0 (LTS) (#4706) * Point-and-click Shell (#4666) * WIP: experimenting with Loft UI Relates to #4470 * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Add selection guard * Working loft for two sketches in the right hardcoded order * First pass at handling more than 2 sketches * WIP selections * WIP selections * More checks * Appends the loft line after the 'last' sketch in the code * Clean up * Enable multiple selections after the button click * First point-click loft test (not working locally, loft gets inserted at the wrong place) * Lint * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * Clean up and working pw test * Add test for doesSceneHaveSweepableSketch with count = 2 * Clean up loftSketches function * Add pw test for preselected sketches * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Move to fromPromise-based Actor * Move error logic out of loftSketches, fix pw tests * Remove comments * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Fix typo * Revert snapshots * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger CI * WIP: initial shell code addition * Rollback pw values to pre cam change * WIP: more additions * WIP: closer * WIP: first time working shell mod * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * Add extrude lookup for more generic shell * Handle walls * Add pw tests for cap shell * Add shell wall test * Fix lint * Add selection guard and clean up * Lint fix * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * WIP mutliple faces * WIP circular dep * Lint * Look at this (photo)Graph *in the voice of Nickelback* * Trigger CI * Working multi-face shell across types * Cap and wall pw test * Apply suggestions from Frank's review Co-authored-by: Frank Noirot <frank@zoo.dev> * Fix test annotations * Add unit tests for doesSceneHaveExtrudedSketch * Manual resolution of snapshot conflicts * Fix assertParse * Updated pathToNode construct --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Frank Noirot <frank@zoo.dev> * More aggressive using of cache on engine settings changes (#4691) * move around the files for cache to better localtions Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * cleanup Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * udpates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * cleanup Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * ensure we can change the grid setting via the command bar Signed-off-by: Jess Frazelle <github@jessfraz.com> * pass thru all setttings Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix playwright test Signed-off-by: Jess Frazelle <github@jessfraz.com> * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * emoty --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * fix use of `as` --------- Signed-off-by: Nick Cameron <nrc@ncameron.org> Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Nick Cameron <nrc@ncameron.org> Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com> Co-authored-by: Tom Pridham <pridham.tom@gmail.com> Co-authored-by: Jess Frazelle <jessfraz@users.noreply.github.com>
2024-12-09 16:43:58 -05:00
selection.graphSelections.forEach((graphSelection) => {
if (!graphSelection.artifact) {
/**
* TODO: remove this heuristic-based selection type detection.
* Currently, if you've created a sketch and have not left sketch mode,
* the selection will be a segment selection with no artifact.
* This is because the mock execution does not update the artifact graph.
* Once we move the artifactGraph creation to WASM, we can remove this,
* as the artifactGraph will always be up-to-date.
*/
if (isSingleCursorInPipe(selection, kclManager.ast)) {
incrementOrInitializeSelectionType('segment')
return
} else {
console.warn(
'Selection is outside of a sketch but has no artifact. Sketch segment selections are the only kind that can have a valid selection with no artifact.',
JSON.stringify(graphSelection)
)
incrementOrInitializeSelectionType('other')
return
}
}
Move `length` and `named value` constraint flows into command palette (#4675) * Extend KCL argument input * Migrate length constraint to be a command * Add ability for `kcl` arguments to provide an initial variable name * Move named variable flow into command palette * Fix one e2e test * Remove unwanted `ZERO` behavior when length constraint has no `variableName` * Fix issue with `getSelectionCountByType` with sketches not yet in artifactGraph * Update broken constraint tests * Look at this (photo)Graph *in the voice of Nickelback* * Fix segment overlays tests, which had out-of-date selectors * Return early from `useConvertToVariable` if no selectionRanges * Fixup for review comment from #4677 (#4696) Signed-off-by: Nick Cameron <nrc@ncameron.org> * Invalidate nightly bucket files after publish (#4627) * Invalidate nightly bucket files after publish * Fix conflict resolution * Add some more warnings (#4697) * Add installation instructions for all platforms (#4592) * Add installation instructions for all platforms Fixes #4511 * Typo * Typo2 * Improve linux instructions, thanks @TomPridham Co-authored-by: Tom Pridham <pridham.tom@gmail.com> --------- Co-authored-by: Tom Pridham <pridham.tom@gmail.com> * Bump node to v22.12.0 (LTS) (#4706) * Point-and-click Shell (#4666) * WIP: experimenting with Loft UI Relates to #4470 * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Add selection guard * Working loft for two sketches in the right hardcoded order * First pass at handling more than 2 sketches * WIP selections * WIP selections * More checks * Appends the loft line after the 'last' sketch in the code * Clean up * Enable multiple selections after the button click * First point-click loft test (not working locally, loft gets inserted at the wrong place) * Lint * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * Clean up and working pw test * Add test for doesSceneHaveSweepableSketch with count = 2 * Clean up loftSketches function * Add pw test for preselected sketches * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Move to fromPromise-based Actor * Move error logic out of loftSketches, fix pw tests * Remove comments * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Fix typo * Revert snapshots * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger CI * WIP: initial shell code addition * Rollback pw values to pre cam change * WIP: more additions * WIP: closer * WIP: first time working shell mod * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * Add extrude lookup for more generic shell * Handle walls * Add pw tests for cap shell * Add shell wall test * Fix lint * Add selection guard and clean up * Lint fix * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * WIP mutliple faces * WIP circular dep * Lint * Look at this (photo)Graph *in the voice of Nickelback* * Trigger CI * Working multi-face shell across types * Cap and wall pw test * Apply suggestions from Frank's review Co-authored-by: Frank Noirot <frank@zoo.dev> * Fix test annotations * Add unit tests for doesSceneHaveExtrudedSketch * Manual resolution of snapshot conflicts * Fix assertParse * Updated pathToNode construct --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Frank Noirot <frank@zoo.dev> * More aggressive using of cache on engine settings changes (#4691) * move around the files for cache to better localtions Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * cleanup Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * udpates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * cleanup Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * ensure we can change the grid setting via the command bar Signed-off-by: Jess Frazelle <github@jessfraz.com> * pass thru all setttings Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix playwright test Signed-off-by: Jess Frazelle <github@jessfraz.com> * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * emoty --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * fix use of `as` --------- Signed-off-by: Nick Cameron <nrc@ncameron.org> Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Nick Cameron <nrc@ncameron.org> Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com> Co-authored-by: Tom Pridham <pridham.tom@gmail.com> Co-authored-by: Jess Frazelle <jessfraz@users.noreply.github.com>
2024-12-09 16:43:58 -05:00
incrementOrInitializeSelectionType(graphSelection.artifact.type)
})
return selectionsByType
Command bar: add extrude command, nonlinear editing, etc (#1204) * Tweak toaster look and feel * Add icons, tweak plus icon names * Rename commandBarMeta to commandBarConfig * Refactor command bar, add support for icons * Create a tailwind plugin for aria-pressed button state * Remove overlay from behind command bar * Clean up toolbar * Button and other style tweaks * Icon tweaks follow-up: make old icons work with new sizing * Delete unused static icons * More CSS tweaks * Small CSS tweak to project sidebar * Add command bar E2E test * fumpt * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * fix typo in a comment * Fix icon padding (built version only) * Update onboarding and warning banner icons padding * Misc minor style fixes * Get Extrude opening and canceling from command bar * Iconography tweaks * Get extrude kind of working * Refactor command bar config types and organization * Move command bar configs to be co-located with each other * Start building a state machine for the command bar * Start converting command bar to state machine * Add support for multiple args, confirmation step * Submission behavior, hotkeys, code organization * Add new test for extruding from command bar * Polish step back and selection hotkeys, CSS tweaks * Loading style tweaks * Validate selection inputs, polish UX of args re-editing * Prevent submission with multiple selection on singlular arg * Remove stray console logs * Tweak test, CSS nit, remove extrude "result" argument * Fix linting warnings * Show Ctrl+/ instead of ⌘K on all platforms but Mac * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * Add "Enter sketch" to command bar * fix command bar test * Fix flaky cmd bar extrude test by waiting for engine select response * Cover both button labels '⌘K' and 'Ctrl+/' in test --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
}
export function getSelectionTypeDisplayText(
selection?: Selections
Command bar: add extrude command, nonlinear editing, etc (#1204) * Tweak toaster look and feel * Add icons, tweak plus icon names * Rename commandBarMeta to commandBarConfig * Refactor command bar, add support for icons * Create a tailwind plugin for aria-pressed button state * Remove overlay from behind command bar * Clean up toolbar * Button and other style tweaks * Icon tweaks follow-up: make old icons work with new sizing * Delete unused static icons * More CSS tweaks * Small CSS tweak to project sidebar * Add command bar E2E test * fumpt * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * fix typo in a comment * Fix icon padding (built version only) * Update onboarding and warning banner icons padding * Misc minor style fixes * Get Extrude opening and canceling from command bar * Iconography tweaks * Get extrude kind of working * Refactor command bar config types and organization * Move command bar configs to be co-located with each other * Start building a state machine for the command bar * Start converting command bar to state machine * Add support for multiple args, confirmation step * Submission behavior, hotkeys, code organization * Add new test for extruding from command bar * Polish step back and selection hotkeys, CSS tweaks * Loading style tweaks * Validate selection inputs, polish UX of args re-editing * Prevent submission with multiple selection on singlular arg * Remove stray console logs * Tweak test, CSS nit, remove extrude "result" argument * Fix linting warnings * Show Ctrl+/ instead of ⌘K on all platforms but Mac * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * Add "Enter sketch" to command bar * fix command bar test * Fix flaky cmd bar extrude test by waiting for engine select response * Cover both button labels '⌘K' and 'Ctrl+/' in test --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
): string | null {
const selectionsByType = getSelectionCountByType(selection)
if (selectionsByType === 'none') return null
Command bar: add extrude command, nonlinear editing, etc (#1204) * Tweak toaster look and feel * Add icons, tweak plus icon names * Rename commandBarMeta to commandBarConfig * Refactor command bar, add support for icons * Create a tailwind plugin for aria-pressed button state * Remove overlay from behind command bar * Clean up toolbar * Button and other style tweaks * Icon tweaks follow-up: make old icons work with new sizing * Delete unused static icons * More CSS tweaks * Small CSS tweak to project sidebar * Add command bar E2E test * fumpt * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * fix typo in a comment * Fix icon padding (built version only) * Update onboarding and warning banner icons padding * Misc minor style fixes * Get Extrude opening and canceling from command bar * Iconography tweaks * Get extrude kind of working * Refactor command bar config types and organization * Move command bar configs to be co-located with each other * Start building a state machine for the command bar * Start converting command bar to state machine * Add support for multiple args, confirmation step * Submission behavior, hotkeys, code organization * Add new test for extruding from command bar * Polish step back and selection hotkeys, CSS tweaks * Loading style tweaks * Validate selection inputs, polish UX of args re-editing * Prevent submission with multiple selection on singlular arg * Remove stray console logs * Tweak test, CSS nit, remove extrude "result" argument * Fix linting warnings * Show Ctrl+/ instead of ⌘K on all platforms but Mac * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * Add "Enter sketch" to command bar * fix command bar test * Fix flaky cmd bar extrude test by waiting for engine select response * Cover both button labels '⌘K' and 'Ctrl+/' in test --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
Allow multiple profiles in the same sketch (#5196) * Revert "Revert multi-profile (#4812)" This reverts commit efe8089b08dd8bdade517f04ace2c81a5e096434. * fix poor 1000ms wait UX * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * Add Rust side artifacts for startSketchOn face or plane (#4834) * Add Rust side artifacts for startSketchOn face or plane * move ast digging --------- Co-authored-by: Kurt Hutten Irev-Dev <k.hutten@protonmail.ch> * lint * lint * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-macos-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-16-cores) * trigger CI * chore: disabled file watcher which prevents faster file write (#4835) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * partial fixes * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * Trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * Trigger CI * Fix up all the tests * Fix partial execution * wip * WIP * wip * rust changes to make three point confrom to same as others since we're not ready with name params yet * most of the fix for 3 point circle * get overlays working for circle three point * fmt * fix types * cargo fmt * add face codef ref for walls and caps * fix sketch on face after updates to rust side artifact graph * some things needed for multi-profile tests * bad attempts at fixing rust * more * more * fix rust * more rust fixes * overlay fix * remove duplicate test * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * lint and typing * maybe fix a unit test * small thing * fix circ dep * fix unit test * fix some tests * fix sweep point-and-click test * fix more tests and add a fix me * fix more tests * fix electron specific test * tsc * more test tweaks * update docs * commint snaps? * is clippy happy now? * clippy again * test works now without me changing anything big-fixed-itself * small bug * make three point have cross hair to make it consistent with othe rtools * fix up state diagram * fmt * add draft point for first click of three point circ * 1 test for three point circle * 2 test for three point circle * clean up * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * remove bad doc comment * remove test skip * remove onboarding test changes * Update src/lang/modifyAst.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * Update output from simulation tests * Fix to use correct source ranges This also reduces cloning. * Change back to skipping face cap none and both * Update output after changing back to skipping none and both * Fix clippy warning * fix profile start snap bug * add path ids to cap * fix going into edit sketch * make other startSketchOn's work * fix snapshot test * explain function name * Update src/lib/rectangleTool.ts Co-authored-by: Frank Noirot <frank@zoo.dev> * rename error * remove file tree from diff * Update src/clientSideScene/segments.ts Co-authored-by: Frank Noirot <frank@zoo.dev> * nit * Prevent double write to KCL code on revolve * Update output after adding cap-to-path graph edge * Fix edit/select sketch-on-cap via feature tree * clean up for face codeRef * fix changing tools part way through circle/rect tools * fix delete of circle profile * fix close profiles * fix closing profile bug (tangentArcTo being ignored) * remove stale comment * Delete paths associated with sketch when the sketch plane is deleted * Add support for deleting sketches on caps (not walls) * get delet working for walls * make delet of extrusions work for multi profile * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * Delete the sketch statement too on the cap and wall cases * Don't write to file in `split-sketch-pipe-if-needed` unless necessary * Don't wait for file write to complete within `updateEditorWithAstAndWriteToFile` It is already debounced internally. If we await it, we will have to wait for a debounced timeout * docs * fix circ dep * tsc * fix selection enter sketch weirdness * test fixes * comment out and fixme for delete related tests * add skip wins * try and get last test to pass --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com> Co-authored-by: Kevin Nadro <nadr0@users.noreply.github.com> Co-authored-by: Pierre Jacquier <pierre@zoo.dev> Co-authored-by: 49lf <ircsurfer33@gmail.com> Co-authored-by: Frank Noirot <frank@zoo.dev> Co-authored-by: Frank Noirot <frankjohnson1993@gmail.com>
2025-02-15 00:57:04 +11:00
return [...selectionsByType.entries()]
.map(
// Hack for showing "face" instead of "extrude-wall" in command bar text
([type, count]) =>
`${count} ${type.replace('wall', 'face').replace('solid2d', 'face')}${
count > 1 ? 's' : ''
}`
)
Command bar: add extrude command, nonlinear editing, etc (#1204) * Tweak toaster look and feel * Add icons, tweak plus icon names * Rename commandBarMeta to commandBarConfig * Refactor command bar, add support for icons * Create a tailwind plugin for aria-pressed button state * Remove overlay from behind command bar * Clean up toolbar * Button and other style tweaks * Icon tweaks follow-up: make old icons work with new sizing * Delete unused static icons * More CSS tweaks * Small CSS tweak to project sidebar * Add command bar E2E test * fumpt * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * fix typo in a comment * Fix icon padding (built version only) * Update onboarding and warning banner icons padding * Misc minor style fixes * Get Extrude opening and canceling from command bar * Iconography tweaks * Get extrude kind of working * Refactor command bar config types and organization * Move command bar configs to be co-located with each other * Start building a state machine for the command bar * Start converting command bar to state machine * Add support for multiple args, confirmation step * Submission behavior, hotkeys, code organization * Add new test for extruding from command bar * Polish step back and selection hotkeys, CSS tweaks * Loading style tweaks * Validate selection inputs, polish UX of args re-editing * Prevent submission with multiple selection on singlular arg * Remove stray console logs * Tweak test, CSS nit, remove extrude "result" argument * Fix linting warnings * Show Ctrl+/ instead of ⌘K on all platforms but Mac * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * Add "Enter sketch" to command bar * fix command bar test * Fix flaky cmd bar extrude test by waiting for engine select response * Cover both button labels '⌘K' and 'Ctrl+/' in test --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
.join(', ')
}
export function canSubmitSelectionArg(
selectionsByType: 'none' | Map<ResolvedSelectionType, number>,
argument: CommandArgument<unknown> & {
inputType: 'selection' | 'selectionMixed'
}
Command bar: add extrude command, nonlinear editing, etc (#1204) * Tweak toaster look and feel * Add icons, tweak plus icon names * Rename commandBarMeta to commandBarConfig * Refactor command bar, add support for icons * Create a tailwind plugin for aria-pressed button state * Remove overlay from behind command bar * Clean up toolbar * Button and other style tweaks * Icon tweaks follow-up: make old icons work with new sizing * Delete unused static icons * More CSS tweaks * Small CSS tweak to project sidebar * Add command bar E2E test * fumpt * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * fix typo in a comment * Fix icon padding (built version only) * Update onboarding and warning banner icons padding * Misc minor style fixes * Get Extrude opening and canceling from command bar * Iconography tweaks * Get extrude kind of working * Refactor command bar config types and organization * Move command bar configs to be co-located with each other * Start building a state machine for the command bar * Start converting command bar to state machine * Add support for multiple args, confirmation step * Submission behavior, hotkeys, code organization * Add new test for extruding from command bar * Polish step back and selection hotkeys, CSS tweaks * Loading style tweaks * Validate selection inputs, polish UX of args re-editing * Prevent submission with multiple selection on singlular arg * Remove stray console logs * Tweak test, CSS nit, remove extrude "result" argument * Fix linting warnings * Show Ctrl+/ instead of ⌘K on all platforms but Mac * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * Add "Enter sketch" to command bar * fix command bar test * Fix flaky cmd bar extrude test by waiting for engine select response * Cover both button labels '⌘K' and 'Ctrl+/' in test --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
) {
return (
selectionsByType !== 'none' &&
Allow multiple profiles in the same sketch (#5196) * Revert "Revert multi-profile (#4812)" This reverts commit efe8089b08dd8bdade517f04ace2c81a5e096434. * fix poor 1000ms wait UX * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * Add Rust side artifacts for startSketchOn face or plane (#4834) * Add Rust side artifacts for startSketchOn face or plane * move ast digging --------- Co-authored-by: Kurt Hutten Irev-Dev <k.hutten@protonmail.ch> * lint * lint * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-macos-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-16-cores) * trigger CI * chore: disabled file watcher which prevents faster file write (#4835) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * partial fixes * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * Trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * Trigger CI * Fix up all the tests * Fix partial execution * wip * WIP * wip * rust changes to make three point confrom to same as others since we're not ready with name params yet * most of the fix for 3 point circle * get overlays working for circle three point * fmt * fix types * cargo fmt * add face codef ref for walls and caps * fix sketch on face after updates to rust side artifact graph * some things needed for multi-profile tests * bad attempts at fixing rust * more * more * fix rust * more rust fixes * overlay fix * remove duplicate test * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * lint and typing * maybe fix a unit test * small thing * fix circ dep * fix unit test * fix some tests * fix sweep point-and-click test * fix more tests and add a fix me * fix more tests * fix electron specific test * tsc * more test tweaks * update docs * commint snaps? * is clippy happy now? * clippy again * test works now without me changing anything big-fixed-itself * small bug * make three point have cross hair to make it consistent with othe rtools * fix up state diagram * fmt * add draft point for first click of three point circ * 1 test for three point circle * 2 test for three point circle * clean up * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * remove bad doc comment * remove test skip * remove onboarding test changes * Update src/lang/modifyAst.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * Update output from simulation tests * Fix to use correct source ranges This also reduces cloning. * Change back to skipping face cap none and both * Update output after changing back to skipping none and both * Fix clippy warning * fix profile start snap bug * add path ids to cap * fix going into edit sketch * make other startSketchOn's work * fix snapshot test * explain function name * Update src/lib/rectangleTool.ts Co-authored-by: Frank Noirot <frank@zoo.dev> * rename error * remove file tree from diff * Update src/clientSideScene/segments.ts Co-authored-by: Frank Noirot <frank@zoo.dev> * nit * Prevent double write to KCL code on revolve * Update output after adding cap-to-path graph edge * Fix edit/select sketch-on-cap via feature tree * clean up for face codeRef * fix changing tools part way through circle/rect tools * fix delete of circle profile * fix close profiles * fix closing profile bug (tangentArcTo being ignored) * remove stale comment * Delete paths associated with sketch when the sketch plane is deleted * Add support for deleting sketches on caps (not walls) * get delet working for walls * make delet of extrusions work for multi profile * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * Delete the sketch statement too on the cap and wall cases * Don't write to file in `split-sketch-pipe-if-needed` unless necessary * Don't wait for file write to complete within `updateEditorWithAstAndWriteToFile` It is already debounced internally. If we await it, we will have to wait for a debounced timeout * docs * fix circ dep * tsc * fix selection enter sketch weirdness * test fixes * comment out and fixme for delete related tests * add skip wins * try and get last test to pass --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com> Co-authored-by: Kevin Nadro <nadr0@users.noreply.github.com> Co-authored-by: Pierre Jacquier <pierre@zoo.dev> Co-authored-by: 49lf <ircsurfer33@gmail.com> Co-authored-by: Frank Noirot <frank@zoo.dev> Co-authored-by: Frank Noirot <frankjohnson1993@gmail.com>
2025-02-15 00:57:04 +11:00
[...selectionsByType.entries()].every(([type, count]) => {
Command bar: add extrude command, nonlinear editing, etc (#1204) * Tweak toaster look and feel * Add icons, tweak plus icon names * Rename commandBarMeta to commandBarConfig * Refactor command bar, add support for icons * Create a tailwind plugin for aria-pressed button state * Remove overlay from behind command bar * Clean up toolbar * Button and other style tweaks * Icon tweaks follow-up: make old icons work with new sizing * Delete unused static icons * More CSS tweaks * Small CSS tweak to project sidebar * Add command bar E2E test * fumpt * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * fix typo in a comment * Fix icon padding (built version only) * Update onboarding and warning banner icons padding * Misc minor style fixes * Get Extrude opening and canceling from command bar * Iconography tweaks * Get extrude kind of working * Refactor command bar config types and organization * Move command bar configs to be co-located with each other * Start building a state machine for the command bar * Start converting command bar to state machine * Add support for multiple args, confirmation step * Submission behavior, hotkeys, code organization * Add new test for extruding from command bar * Polish step back and selection hotkeys, CSS tweaks * Loading style tweaks * Validate selection inputs, polish UX of args re-editing * Prevent submission with multiple selection on singlular arg * Remove stray console logs * Tweak test, CSS nit, remove extrude "result" argument * Fix linting warnings * Show Ctrl+/ instead of ⌘K on all platforms but Mac * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * Add "Enter sketch" to command bar * fix command bar test * Fix flaky cmd bar extrude test by waiting for engine select response * Cover both button labels '⌘K' and 'Ctrl+/' in test --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
const foundIndex = argument.selectionTypes.findIndex((s) => s === type)
return (
foundIndex !== -1 &&
(!argument.multiple ? count < 2 && count > 0 : count > 0)
)
})
)
}
SketchOnFace UI (#1664) * always enter edit mode * initial blocking of extra code-mirror updates * dry out code * rejig selections * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * clean up * stream clean up * update export * sketch mode can be entered and exited for extrude faces But has bugs * startSketchOn working in some cases, editsketch animation working but not orientation of instersection plane etc * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit 406fca4c553681fbad882167a9c1ab380af52899. * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * remove comment * add sketch on face e2e test * tweenCamToNegYAxis should respect reduced motion * initial sketch on face working with test * remove temporary toolbar button and xState flow * un-used vars * snapshot test tweak * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * type tidy up * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit c39b8ebf954fa63556e21da081031b8acd77c909. * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit fecf6f490af6ced34959653984108958fb504f82. * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * rename * sketch on sketch on sketch * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * typo * startSketchOn Endcaps end works, start is weird still * clear selections for entity_ids that are not recognised * fix sketch on end cap of second order extrustion * tiny clean up * fix sketch on close segment/face * clean up 'lastCodeMirrorSelectionUpdatedFromScene' * add code mode test for sketchOnExtrudedFace * make end cap selection more robust * update js artifacts for extrudes * update kcl docs * clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-22 10:23:04 +11:00
/**
* Find the index of the last range where range.start < targetStart. When there
* are ranges with equal start positions just before the targetStart, the first
* one is returned. The returned index can be used as a starting point for
* linear search of overlapping ranges.
*
* @param index The sorted array of ranges to search through
* @param targetStart The start position to compare against
* @returns The index of the last range where range[0] < targetStart
*/
export function findLastRangeStartingBefore(
index: ArtifactIndex,
targetStart: number
): number {
if (index.length === 0) {
return 0
}
let left = 0
let right = index.length - 1
let lastValidIndex = 0
while (left <= right) {
const mid = left + Math.floor((right - left) / 2)
const midRange = index[mid].range
if (midRange[0] < targetStart) {
// This range starts before our selection, look in right half for later ones
lastValidIndex = mid
left = mid + 1
} else {
// This range starts at or after our selection, look in left half
right = mid - 1
}
}
// We may have passed the correct index. Consider what happens when there are
// duplicates. We found the last one, but earlier ones need to be checked too.
let resultIndex = lastValidIndex
let resultRange = index[resultIndex].range
for (let i = lastValidIndex - 1; i >= 0; i--) {
const range = index[i].range
if (range[0] === resultRange[0]) {
resultIndex = i
resultRange = range
} else {
break
}
}
return resultIndex
}
function findOverlappingArtifactsFromIndex(
selection: Selection,
index: ArtifactIndex
): ArtifactEntry[] {
if (!selection.codeRef?.range) {
console.warn('Selection missing code reference range')
return []
}
const selectionRange = selection.codeRef.range
const results: ArtifactEntry[] = []
// Binary search to find the last range where range[0] < selectionRange[0]
// This search does not take into consideration the end range, so it's possible
// the index it finds dose not have any overlap (depending on the end range)
// but it's main purpose is to act as a starting point for the linear part of the search
// so a tiny loss in efficiency is acceptable to keep the code simple
const startIndex = findLastRangeStartingBefore(index, selectionRange[0])
// Check all potential overlaps from the found position
for (let i = startIndex; i < index.length; i++) {
const { range, entry } = index[i]
// Stop if we've gone past possible overlaps
if (range[0] > selectionRange[1]) break
if (isOverlap(range, selectionRange)) {
results.push(entry)
}
}
return results
}
function getBestCandidate(
entries: ArtifactEntry[],
artifactGraph: ArtifactGraph
): ArtifactEntry | undefined {
if (!entries.length) {
return undefined
}
for (const entry of entries) {
// Segments take precedence
if (entry.artifact.type === 'segment') {
return entry
}
// Handle paths and their solid2d references
if (entry.artifact.type === 'path') {
const solid2dId = entry.artifact.solid2dId
if (!solid2dId) {
return entry
}
const solid2d = artifactGraph.get(solid2dId)
if (solid2d?.type === 'solid2d') {
return { id: solid2dId, artifact: solid2d }
}
continue
}
// Other valid artifact types
if (['plane', 'cap', 'wall', 'sweep'].includes(entry.artifact.type)) {
return entry
}
}
return undefined
}
function createSelectionToEngine(
selection: Selection,
candidateId?: ArtifactId
): SelectionToEngine {
return {
...(candidateId && { id: candidateId }),
range: selection.codeRef.range,
}
}
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
export function codeToIdSelections(
selections: Selection[],
artifactGraph: ArtifactGraph,
artifactIndex: ArtifactIndex
SketchOnFace UI (#1664) * always enter edit mode * initial blocking of extra code-mirror updates * dry out code * rejig selections * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * clean up * stream clean up * update export * sketch mode can be entered and exited for extrude faces But has bugs * startSketchOn working in some cases, editsketch animation working but not orientation of instersection plane etc * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit 406fca4c553681fbad882167a9c1ab380af52899. * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * remove comment * add sketch on face e2e test * tweenCamToNegYAxis should respect reduced motion * initial sketch on face working with test * remove temporary toolbar button and xState flow * un-used vars * snapshot test tweak * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * type tidy up * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit c39b8ebf954fa63556e21da081031b8acd77c909. * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit fecf6f490af6ced34959653984108958fb504f82. * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * rename * sketch on sketch on sketch * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * typo * startSketchOn Endcaps end works, start is weird still * clear selections for entity_ids that are not recognised * fix sketch on end cap of second order extrustion * tiny clean up * fix sketch on close segment/face * clean up 'lastCodeMirrorSelectionUpdatedFromScene' * add code mode test for sketchOnExtrudedFace * make end cap selection more robust * update js artifacts for extrudes * update kcl docs * clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-22 10:23:04 +11:00
): SelectionToEngine[] {
if (!selections?.length) {
return []
}
SketchOnFace UI (#1664) * always enter edit mode * initial blocking of extra code-mirror updates * dry out code * rejig selections * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * clean up * stream clean up * update export * sketch mode can be entered and exited for extrude faces But has bugs * startSketchOn working in some cases, editsketch animation working but not orientation of instersection plane etc * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit 406fca4c553681fbad882167a9c1ab380af52899. * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * remove comment * add sketch on face e2e test * tweenCamToNegYAxis should respect reduced motion * initial sketch on face working with test * remove temporary toolbar button and xState flow * un-used vars * snapshot test tweak * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * type tidy up * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit c39b8ebf954fa63556e21da081031b8acd77c909. * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit fecf6f490af6ced34959653984108958fb504f82. * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * rename * sketch on sketch on sketch * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * typo * startSketchOn Endcaps end works, start is weird still * clear selections for entity_ids that are not recognised * fix sketch on end cap of second order extrustion * tiny clean up * fix sketch on close segment/face * clean up 'lastCodeMirrorSelectionUpdatedFromScene' * add code mode test for sketchOnExtrudedFace * make end cap selection more robust * update js artifacts for extrudes * update kcl docs * clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-22 10:23:04 +11:00
if (!artifactGraph) {
console.warn('Artifact graph is missing or empty')
return selections.map((selection) => createSelectionToEngine(selection))
}
return selections
.flatMap((selection): SelectionToEngine[] => {
if (!selection) {
console.warn('Null or undefined selection encountered')
return []
SketchOnFace UI (#1664) * always enter edit mode * initial blocking of extra code-mirror updates * dry out code * rejig selections * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * clean up * stream clean up * update export * sketch mode can be entered and exited for extrude faces But has bugs * startSketchOn working in some cases, editsketch animation working but not orientation of instersection plane etc * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit 406fca4c553681fbad882167a9c1ab380af52899. * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * remove comment * add sketch on face e2e test * tweenCamToNegYAxis should respect reduced motion * initial sketch on face working with test * remove temporary toolbar button and xState flow * un-used vars * snapshot test tweak * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * type tidy up * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit c39b8ebf954fa63556e21da081031b8acd77c909. * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit fecf6f490af6ced34959653984108958fb504f82. * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * rename * sketch on sketch on sketch * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * typo * startSketchOn Endcaps end works, start is weird still * clear selections for entity_ids that are not recognised * fix sketch on end cap of second order extrustion * tiny clean up * fix sketch on close segment/face * clean up 'lastCodeMirrorSelectionUpdatedFromScene' * add code mode test for sketchOnExtrudedFace * make end cap selection more robust * update js artifacts for extrudes * update kcl docs * clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-22 10:23:04 +11:00
}
// Direct artifact case
if (selection.artifact?.id) {
return [createSelectionToEngine(selection, selection.artifact.id)]
}
// Find matching artifacts by code range overlap
const overlappingEntries = findOverlappingArtifactsFromIndex(
selection,
artifactIndex
)
const bestCandidate = getBestCandidate(overlappingEntries, artifactGraph)
return [createSelectionToEngine(selection, bestCandidate?.id)]
SketchOnFace UI (#1664) * always enter edit mode * initial blocking of extra code-mirror updates * dry out code * rejig selections * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * clean up * stream clean up * update export * sketch mode can be entered and exited for extrude faces But has bugs * startSketchOn working in some cases, editsketch animation working but not orientation of instersection plane etc * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit 406fca4c553681fbad882167a9c1ab380af52899. * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * remove comment * add sketch on face e2e test * tweenCamToNegYAxis should respect reduced motion * initial sketch on face working with test * remove temporary toolbar button and xState flow * un-used vars * snapshot test tweak * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * type tidy up * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit c39b8ebf954fa63556e21da081031b8acd77c909. * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit fecf6f490af6ced34959653984108958fb504f82. * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * rename * sketch on sketch on sketch * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * typo * startSketchOn Endcaps end works, start is weird still * clear selections for entity_ids that are not recognised * fix sketch on end cap of second order extrustion * tiny clean up * fix sketch on close segment/face * clean up 'lastCodeMirrorSelectionUpdatedFromScene' * add code mode test for sketchOnExtrudedFace * make end cap selection more robust * update js artifacts for extrudes * update kcl docs * clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-22 10:23:04 +11:00
})
.filter(isNonNullable)
SketchOnFace UI (#1664) * always enter edit mode * initial blocking of extra code-mirror updates * dry out code * rejig selections * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * clean up * stream clean up * update export * sketch mode can be entered and exited for extrude faces But has bugs * startSketchOn working in some cases, editsketch animation working but not orientation of instersection plane etc * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit 406fca4c553681fbad882167a9c1ab380af52899. * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * remove comment * add sketch on face e2e test * tweenCamToNegYAxis should respect reduced motion * initial sketch on face working with test * remove temporary toolbar button and xState flow * un-used vars * snapshot test tweak * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * type tidy up * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit c39b8ebf954fa63556e21da081031b8acd77c909. * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit fecf6f490af6ced34959653984108958fb504f82. * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * rename * sketch on sketch on sketch * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * typo * startSketchOn Endcaps end works, start is weird still * clear selections for entity_ids that are not recognised * fix sketch on end cap of second order extrustion * tiny clean up * fix sketch on close segment/face * clean up 'lastCodeMirrorSelectionUpdatedFromScene' * add code mode test for sketchOnExtrudedFace * make end cap selection more robust * update js artifacts for extrudes * update kcl docs * clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-22 10:23:04 +11:00
}
export async function sendSelectEventToEngine(
e: React.MouseEvent<HTMLDivElement, MouseEvent>
SketchOnFace UI (#1664) * always enter edit mode * initial blocking of extra code-mirror updates * dry out code * rejig selections * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * clean up * stream clean up * update export * sketch mode can be entered and exited for extrude faces But has bugs * startSketchOn working in some cases, editsketch animation working but not orientation of instersection plane etc * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit 406fca4c553681fbad882167a9c1ab380af52899. * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * remove comment * add sketch on face e2e test * tweenCamToNegYAxis should respect reduced motion * initial sketch on face working with test * remove temporary toolbar button and xState flow * un-used vars * snapshot test tweak * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * type tidy up * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit c39b8ebf954fa63556e21da081031b8acd77c909. * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit fecf6f490af6ced34959653984108958fb504f82. * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * rename * sketch on sketch on sketch * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * typo * startSketchOn Endcaps end works, start is weird still * clear selections for entity_ids that are not recognised * fix sketch on end cap of second order extrustion * tiny clean up * fix sketch on close segment/face * clean up 'lastCodeMirrorSelectionUpdatedFromScene' * add code mode test for sketchOnExtrudedFace * make end cap selection more robust * update js artifacts for extrudes * update kcl docs * clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-22 10:23:04 +11:00
) {
// No video stream to normalise against, return immediately
Stream handling / Stream idle mode v2; a ton of network related changes (ping; scene indicator -> stream indicator, stream resizing (even on pause)) (#5312) * Add back stream idle mode * Shut up codespell * Correct serialization; only expose at user level * cargo fmt * tsc lint fmt * Move engineStreamMachine as a global actor; tons of more work * Fix up everything after bumping kittycad/lib * Remove camera sync * Use pause/play iconology * Add back better ping indicator * wip * Fix streamIdleMode checkbox being wonky * yarn fmt * Massive extinction event for waitForExecutionDone; try to stop projects view switching from crashing * Clear diagnostics when unmounting code editor! * wip * Rework initial root projects dir + deflake many projects tests * More e2e fixes * Deflake revolve some revolve tests * Fix the rest of the mfing tests * yarn fmt * yarn lint * yarn tsc * Fix tsc after rebase * wip * less flaky point and click * wip * Fixup after rebase * Fix more tests * Fix 2 more * Fix up named-views tests * yarn fmt lint tsc * Fix up new changes * Get rid of 1 cyclic dependency * Fix another cyclic mfer! * fmt * fmt tsc * Fix zoom to fit being frigged * a new list of circular deps * Remove NetworkHealthIndicator test that was shit * Fix the bad reload repeat issue kevin started on * Fix zoom to fit at the right moments... * Fix cache count numbers in editor test * Remove a test race - poll window info. * Qualify fail function * Try something * Use scene.connectionEstablished * Hopefully fix snapshots at least * Add app console.log * Fix native menu tests more * tsc lint * Fix camera failure * Try again * Test attempt number 15345203, action! * Add back old window detection heuristic * Remove firstWindow to complete the work of 2342d04fe244c327cdb1a1a721e5a125c08a2909 * Tweak some tests for MacOS * Tweak "set appearance" test for MacOS Revert this if it messes up any other platform's color checks! * Are you serious? This was all that needed formatting? * More color tweaks Local MacOS and CI MacOS don't agree * Fixes on apperance e2e test for stream idle branch (#6168) pierremtb/stream-idle-revamp-appearance-fixes * Another apperance fix * Skip one native menu test to make stream idle green (#6169) * pierremtb/stream-idle-revamp-more-fixes * Fix lint * Update snapshot for test_generate_settings_docs --------- Co-authored-by: lee-at-zoo-corp <lee@zoo.dev> Co-authored-by: Frank Noirot <frankjohnson1993@gmail.com> Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com> Co-authored-by: Pierre Jacquier <pierre@zoo.dev>
2025-04-07 07:08:31 -04:00
const engineStreamState = engineStreamActor.getSnapshot().context
if (!engineStreamState.videoRef.current)
return Promise.reject('video element not ready')
const { x, y } = getNormalisedCoordinates(
e,
Stream handling / Stream idle mode v2; a ton of network related changes (ping; scene indicator -> stream indicator, stream resizing (even on pause)) (#5312) * Add back stream idle mode * Shut up codespell * Correct serialization; only expose at user level * cargo fmt * tsc lint fmt * Move engineStreamMachine as a global actor; tons of more work * Fix up everything after bumping kittycad/lib * Remove camera sync * Use pause/play iconology * Add back better ping indicator * wip * Fix streamIdleMode checkbox being wonky * yarn fmt * Massive extinction event for waitForExecutionDone; try to stop projects view switching from crashing * Clear diagnostics when unmounting code editor! * wip * Rework initial root projects dir + deflake many projects tests * More e2e fixes * Deflake revolve some revolve tests * Fix the rest of the mfing tests * yarn fmt * yarn lint * yarn tsc * Fix tsc after rebase * wip * less flaky point and click * wip * Fixup after rebase * Fix more tests * Fix 2 more * Fix up named-views tests * yarn fmt lint tsc * Fix up new changes * Get rid of 1 cyclic dependency * Fix another cyclic mfer! * fmt * fmt tsc * Fix zoom to fit being frigged * a new list of circular deps * Remove NetworkHealthIndicator test that was shit * Fix the bad reload repeat issue kevin started on * Fix zoom to fit at the right moments... * Fix cache count numbers in editor test * Remove a test race - poll window info. * Qualify fail function * Try something * Use scene.connectionEstablished * Hopefully fix snapshots at least * Add app console.log * Fix native menu tests more * tsc lint * Fix camera failure * Try again * Test attempt number 15345203, action! * Add back old window detection heuristic * Remove firstWindow to complete the work of 2342d04fe244c327cdb1a1a721e5a125c08a2909 * Tweak some tests for MacOS * Tweak "set appearance" test for MacOS Revert this if it messes up any other platform's color checks! * Are you serious? This was all that needed formatting? * More color tweaks Local MacOS and CI MacOS don't agree * Fixes on apperance e2e test for stream idle branch (#6168) pierremtb/stream-idle-revamp-appearance-fixes * Another apperance fix * Skip one native menu test to make stream idle green (#6169) * pierremtb/stream-idle-revamp-more-fixes * Fix lint * Update snapshot for test_generate_settings_docs --------- Co-authored-by: lee-at-zoo-corp <lee@zoo.dev> Co-authored-by: Frank Noirot <frankjohnson1993@gmail.com> Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com> Co-authored-by: Pierre Jacquier <pierre@zoo.dev>
2025-04-07 07:08:31 -04:00
engineStreamState.videoRef.current,
engineCommandManager.streamDimensions
)
let res = await engineCommandManager.sendSceneCommand({
type: 'modeling_cmd_req',
cmd: {
type: 'select_with_point',
selected_at_window: { x, y },
selection_type: 'add',
},
cmd_id: uuidv4(),
})
if (!res) {
return Promise.reject('no response')
}
if (isArray(res)) {
res = res[0]
}
if (
res?.success &&
res?.resp?.type === 'modeling' &&
res?.resp?.data?.modeling_response.type === 'select_with_point'
)
return res?.resp?.data?.modeling_response?.data
return { entity_id: '' }
SketchOnFace UI (#1664) * always enter edit mode * initial blocking of extra code-mirror updates * dry out code * rejig selections * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * clean up * stream clean up * update export * sketch mode can be entered and exited for extrude faces But has bugs * startSketchOn working in some cases, editsketch animation working but not orientation of instersection plane etc * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit 406fca4c553681fbad882167a9c1ab380af52899. * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * remove comment * add sketch on face e2e test * tweenCamToNegYAxis should respect reduced motion * initial sketch on face working with test * remove temporary toolbar button and xState flow * un-used vars * snapshot test tweak * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * type tidy up * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit c39b8ebf954fa63556e21da081031b8acd77c909. * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" This reverts commit fecf6f490af6ced34959653984108958fb504f82. * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * rename * sketch on sketch on sketch * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * typo * startSketchOn Endcaps end works, start is weird still * clear selections for entity_ids that are not recognised * fix sketch on end cap of second order extrustion * tiny clean up * fix sketch on close segment/face * clean up 'lastCodeMirrorSelectionUpdatedFromScene' * add code mode test for sketchOnExtrudedFace * make end cap selection more robust * update js artifacts for extrudes * update kcl docs * clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-22 10:23:04 +11:00
}
export function updateSelections(
pathToNodeMap: PathToNodeMap,
prevSelectionRanges: Selections,
ast: Program | Error
): Selections | Error {
if (err(ast)) return ast
const newSelections = Object.entries(pathToNodeMap)
.map(([index, pathToNode]): Selection | undefined => {
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
const previousSelection =
prevSelectionRanges.graphSelections[Number(index)]
const nodeMeta = getNodeFromPath<Expr>(ast, pathToNode)
if (err(nodeMeta)) return undefined
const node = nodeMeta.node
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
let artifact: Artifact | null = null
for (const [id, a] of kclManager.artifactGraph) {
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
if (previousSelection?.artifact?.type === a.type) {
const codeRefs = getCodeRefsByArtifactId(id, kclManager.artifactGraph)
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
if (!codeRefs) continue
if (
JSON.stringify(codeRefs[0].pathToNode) ===
JSON.stringify(pathToNode)
) {
artifact = a
break
}
}
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
}
if (!artifact) return undefined
return {
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
artifact: artifact,
codeRef: {
Rust artifact graph (#5068) * Start porting artifact graph creation to Rust * Add most of artifact graph creation * Add handling loft command from recent PR * Refactor artifact merge code so that it errors when a new artifact type is added * Add sweep subtype * Finish implementation of build artifact graph * Fix wasm.ts to use new combined generated ts-rs file * Fix Rust lints * Fix lints * Fix up replacement code * Add artifact graph to WASM outcome * Add artifact graph to simulation test output * Add new artifact graph output snapshots * Fix wall field and reduce unreachable code * Change field order for subtype * Change subtype to be determined from the request, like the TS * Fix plane sweep_id * Condense code * Change ID types to be properly optional * Change to favor the new ID, the same as TS * Fix to make error impossible * Rename artifact type tag values to match TS * Fix name of field on Cap * Update outputs * Change to use Rust source range * Update output snapshots * Add conversion to mermaid mind map and add to snapshot tests * Add new mermaid mind map output * Add flowchart * Remove raw artifact graph from tests * Remove JSON artifact graph output * Update output file with header * Update output after adding flowchart * Fix flowchart to not have duplicate edges, one in each direction * Fix not not output duplicate edges in flowcharts * Change flowchart edge style to be more obvious when a direction is missing * Update output after deduplication of edges * Fix not not skip sketch-on-face artifacts * Add docs * Fix edge iteration order to be stable * Update output after fixing order * Port TS artifactGraph.test.ts tests to simulation tests * Add grouping segments and solid2ds with their path * Update output flowcharts since grouping paths * Remove TS artifactGraph tests * Remove unused d3 dependencies * Fix to track loft ID on paths * Add command ID to error messages * Move artifact graph test code to a separate file since it's a large file * Reduce function visibility * Remove TS artifact graph code * Fix spelling error with serde * Add TODO for edge cut consumed ID * Add comment about mermaid edge rank * Fix mermaid flowchart edge cuts to appear as children of their edges * Update output since fixing flowchart order * Fix to always build the artifact graph even when there's a KCL error * Add artifact graph to error output * Change optional ID merge to match TS * Remove redundant SourceRange definition * Remove Rust-flavored default source range function * Add helper for source range creation * Update doc comment for the website * Update docs after doc comment change * Fix to save engine responses in execution cache * Remove unused import * Fix to not call WASM function before beforeAll callback is run * Remove more unused imports
2025-01-17 14:34:36 -05:00
range: topLevelRange(node.start, node.end),
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
pathToNode: pathToNode,
},
}
})
.filter((x?: Selection) => x !== undefined)
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
// for when there is no artifact (sketch mode since mock execute does not update artifactGraph)
const pathToNodeBasedSelections: Selections['graphSelections'] = []
for (const pathToNode of Object.values(pathToNodeMap)) {
const node = getNodeFromPath<Expr>(ast, pathToNode)
if (err(node)) return node
pathToNodeBasedSelections.push({
codeRef: {
Rust artifact graph (#5068) * Start porting artifact graph creation to Rust * Add most of artifact graph creation * Add handling loft command from recent PR * Refactor artifact merge code so that it errors when a new artifact type is added * Add sweep subtype * Finish implementation of build artifact graph * Fix wasm.ts to use new combined generated ts-rs file * Fix Rust lints * Fix lints * Fix up replacement code * Add artifact graph to WASM outcome * Add artifact graph to simulation test output * Add new artifact graph output snapshots * Fix wall field and reduce unreachable code * Change field order for subtype * Change subtype to be determined from the request, like the TS * Fix plane sweep_id * Condense code * Change ID types to be properly optional * Change to favor the new ID, the same as TS * Fix to make error impossible * Rename artifact type tag values to match TS * Fix name of field on Cap * Update outputs * Change to use Rust source range * Update output snapshots * Add conversion to mermaid mind map and add to snapshot tests * Add new mermaid mind map output * Add flowchart * Remove raw artifact graph from tests * Remove JSON artifact graph output * Update output file with header * Update output after adding flowchart * Fix flowchart to not have duplicate edges, one in each direction * Fix not not output duplicate edges in flowcharts * Change flowchart edge style to be more obvious when a direction is missing * Update output after deduplication of edges * Fix not not skip sketch-on-face artifacts * Add docs * Fix edge iteration order to be stable * Update output after fixing order * Port TS artifactGraph.test.ts tests to simulation tests * Add grouping segments and solid2ds with their path * Update output flowcharts since grouping paths * Remove TS artifactGraph tests * Remove unused d3 dependencies * Fix to track loft ID on paths * Add command ID to error messages * Move artifact graph test code to a separate file since it's a large file * Reduce function visibility * Remove TS artifact graph code * Fix spelling error with serde * Add TODO for edge cut consumed ID * Add comment about mermaid edge rank * Fix mermaid flowchart edge cuts to appear as children of their edges * Update output since fixing flowchart order * Fix to always build the artifact graph even when there's a KCL error * Add artifact graph to error output * Change optional ID merge to match TS * Remove redundant SourceRange definition * Remove Rust-flavored default source range function * Add helper for source range creation * Update doc comment for the website * Update docs after doc comment change * Fix to save engine responses in execution cache * Remove unused import * Fix to not call WASM function before beforeAll callback is run * Remove more unused imports
2025-01-17 14:34:36 -05:00
range: topLevelRange(node.node.start, node.node.end),
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
pathToNode: pathToNode,
},
})
}
return {
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
graphSelections:
newSelections.length >= pathToNodeBasedSelections.length
? newSelections
Selections Refactor (#4381) * selection stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * fix bugs * some edge cut stuff * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch mode issues * fix more tests, selection in sketch related * more test fixing * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger ci * more sketch mode selection fixes * fix unit tests * rename function * remove .only * migrate a more selections types * migrate a more selections types * migrate a more selections types * lint * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad pathToNode issue * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * fix sketch on face * migrate a more selections types * migrate a more selections types * fix code selection of fillets * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * migrate a more selections types * fix bad path to node, looks like a race * migrate a more selections types * migrate a more selections types * fix cmd bar selections * fix cmd bar selections * fix display issues * migrate a more selections types * Revert "migrate a more selections types" This reverts commit 0d0e453bbbb82d10472b6c9e753c53c8b7e3609d. * migrate a more selections types * clean up1 * clean up 2 * fix types after main merge * review tweaks * fix wall selection bug * Update src/lang/std/engineConnection.ts Co-authored-by: Jonathan Tran <jonnytran@gmail.com> * add franks TODO comment * fix type after main merge, plus a touch of clean up --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2024-11-21 15:04:30 +11:00
: pathToNodeBasedSelections,
otherSelections: prevSelectionRanges.otherSelections,
}
}