initial implementation of sketching on extrude face

This commit is contained in:
Kurt Hutten IrevDev
2023-01-09 13:19:14 +11:00
parent 2e007ae288
commit ed686e5e69
6 changed files with 194 additions and 12 deletions

View File

@ -216,7 +216,7 @@ function RenderViewerArtifact({
const [editorCursor, setEditorCursor] = useState(false)
useEffect(() => {
const shouldHighlight = isOverlapping(
artifact.__meta.slice(-1)[0].sourceRange,
artifact.__meta[0].sourceRange,
selectionRange
)
setEditorCursor(shouldHighlight)
@ -238,10 +238,22 @@ function RenderViewerArtifact({
)
const { rotation, position } = artifact
setGuiMode({ mode: 'canEditSketch', pathToNode, rotation, position })
} else if (
shouldHighlight &&
(guiMode.mode === 'default' || guiMode.mode === 'canEditSketch') &&
ast &&
artifact.type === 'extrudeGroup'
) {
const pathToNode = getNodePathFromSourceRange(
ast,
artifact.__meta[0].sourceRange
)
const { rotation, position } = artifact
setGuiMode({ mode: 'canEditExtrude', pathToNode, rotation, position })
} else if (
!shouldHighlight &&
guiMode.mode === 'canEditSketch' &&
artifact.type === 'sketchGroup'
(guiMode.mode === 'canEditSketch' || guiMode.mode === 'canEditExtrude') &&
(artifact.type === 'sketchGroup' || artifact.type === 'extrudeGroup')
) {
setGuiMode({ mode: 'default' })
}