Disable extrude button if there is no extrudable geometry (#2730)

Disable extrude button if there is no extrudeable geometry
This commit is contained in:
Kurt Hutten
2024-06-21 13:20:42 +10:00
committed by GitHub
parent 1beb6b5186
commit d85211c5a4
5 changed files with 242 additions and 2 deletions

View File

@ -63,6 +63,7 @@ import {
import {
getNodeFromPath,
getNodePathFromSourceRange,
hasExtrudableGeometry,
isSingleCursorInPipe,
} from 'lang/queryAst'
import { TEST } from 'env'
@ -447,8 +448,13 @@ export const ModelingMachineProvider = ({
if (
selectionRanges.codeBasedSelections.length === 0 ||
isSelectionLastLine(selectionRanges, codeManager.code)
)
return true
) {
// they have no selection, we should enable the button
// so they can select the face through the cmdbar
// BUT only if there's extrudable geometry
if (hasExtrudableGeometry(kclManager.ast)) return true
return false
}
if (!isPipe) return false
return canExtrudeSelection(selectionRanges)