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