diff --git a/src/clientSideScene/sceneEntities.ts b/src/clientSideScene/sceneEntities.ts index 17ee8f4f6..7f31df4f4 100644 --- a/src/clientSideScene/sceneEntities.ts +++ b/src/clientSideScene/sceneEntities.ts @@ -918,9 +918,9 @@ export class SceneEntities { // Prepare to update the THREEjs scene this.sceneProgramMemory = programMemory const sketchGroup = sketchGroupFromKclValue( - programMemory.get( + programMemory.get(variableDeclarationName), variableDeclarationName - ), variableDeclarationName) + ) if (err(sketchGroup)) return Promise.reject(sketchGroup) const sgPaths = sketchGroup.value const orthoFactor = orthoScale(sceneInfra.camControls.camera) @@ -1322,7 +1322,6 @@ export class SceneEntities { (group.userData.center[0] - dragTo[0]) ** 2 ) ) - console.log('modded', modded) } else if ( group.name === CIRCLE_SEGMENT && subGroup?.name === CIRCLE_CENTER_HANDLE @@ -1335,7 +1334,6 @@ export class SceneEntities { dragTo, group.userData.radius ) - console.log('modded', modded) } else { modded = changeSketchArguments( modifiedAst, @@ -1630,7 +1628,7 @@ export class SceneEntities { const hoveredParent = sceneInfra.hoveredObject && - getParentGroup(sceneInfra.hoveredObject, [TANGENTIAL_ARC_TO_SEGMENT]) + getParentGroup(sceneInfra.hoveredObject, [CIRCLE_SEGMENT]) let isHandlesVisible = !shouldHideIdle if (hoveredParent && hoveredParent?.uuid === group?.uuid) { isHandlesVisible = !shouldHideHover @@ -1899,6 +1897,7 @@ export class SceneEntities { const parent = getParentGroup(selected, [ STRAIGHT_SEGMENT, TANGENTIAL_ARC_TO_SEGMENT, + CIRCLE_SEGMENT, PROFILE_START, ]) if (parent?.userData?.pathToNode) { @@ -1964,6 +1963,7 @@ export class SceneEntities { const parent = getParentGroup(selected, [ STRAIGHT_SEGMENT, TANGENTIAL_ARC_TO_SEGMENT, + CIRCLE_SEGMENT, PROFILE_START, ]) if (parent) { @@ -2161,7 +2161,11 @@ function prepareTruncatedMemoryAndAst( export function getParentGroup( object: any, - stopAt: string[] = [STRAIGHT_SEGMENT, TANGENTIAL_ARC_TO_SEGMENT] + stopAt: string[] = [ + STRAIGHT_SEGMENT, + TANGENTIAL_ARC_TO_SEGMENT, + CIRCLE_SEGMENT, + ] ): Group | null { if (stopAt.includes(object?.userData?.type)) { return object diff --git a/src/components/ModelingMachineProvider.tsx b/src/components/ModelingMachineProvider.tsx index 801a3cef7..c1a4e532f 100644 --- a/src/components/ModelingMachineProvider.tsx +++ b/src/components/ModelingMachineProvider.tsx @@ -50,6 +50,7 @@ import { applyConstraintAbsDistance } from './Toolbar/SetAbsDistance' import useStateMachineCommands from 'hooks/useStateMachineCommands' import { modelingMachineCommandConfig } from 'lib/commandBarConfigs/modelingCommandConfig' import { + CIRCLE_SEGMENT, STRAIGHT_SEGMENT, TANGENTIAL_ARC_TO_SEGMENT, getParentGroup, @@ -179,6 +180,7 @@ export const ModelingMachineProvider = ({ const parent = getParentGroup(event.data.on, [ STRAIGHT_SEGMENT, TANGENTIAL_ARC_TO_SEGMENT, + CIRCLE_SEGMENT, ]) const pathToNode = parent?.userData?.pathToNode const pathToNodeString = JSON.stringify(pathToNode) @@ -196,6 +198,7 @@ export const ModelingMachineProvider = ({ const mouseOnParent = getParentGroup(mouseState.on, [ STRAIGHT_SEGMENT, TANGENTIAL_ARC_TO_SEGMENT, + CIRCLE_SEGMENT, ]) if (!mouseOnParent || !mouseOnParent?.userData?.pathToNode) return segmentHoverMap diff --git a/src/lib/selections.ts b/src/lib/selections.ts index e1faf4734..0d96e74e2 100644 --- a/src/lib/selections.ts +++ b/src/lib/selections.ts @@ -24,6 +24,7 @@ import { TANGENTIAL_ARC_TO_SEGMENT, getParentGroup, PROFILE_START, + CIRCLE_SEGMENT, } from 'clientSideScene/sceneEntities' import { Mesh, Object3D, Object3DEventMap } from 'three' import { AXIS_GROUP, X_AXIS } from 'clientSideScene/sceneInfra' @@ -150,6 +151,7 @@ export function getEventForSegmentSelection( const group = getParentGroup(obj, [ STRAIGHT_SEGMENT, TANGENTIAL_ARC_TO_SEGMENT, + CIRCLE_SEGMENT, PROFILE_START, ]) const axisGroup = getParentGroup(obj, [AXIS_GROUP]) @@ -290,9 +292,12 @@ function updateSceneObjectColors(codeBasedSelections: Selection[]) { Object.values(sceneEntitiesManager.activeSegments).forEach((segmentGroup) => { if ( - ![STRAIGHT_SEGMENT, TANGENTIAL_ARC_TO_SEGMENT, PROFILE_START].includes( - segmentGroup?.name - ) + ![ + STRAIGHT_SEGMENT, + TANGENTIAL_ARC_TO_SEGMENT, + PROFILE_START, + CIRCLE_SEGMENT, + ].includes(segmentGroup?.name) ) return const nodeMeta = getNodeFromPath(