Fixups
This commit is contained in:
@ -318,7 +318,6 @@ test.describe('Testing settings', () => {
|
|||||||
timeout: 5_000,
|
timeout: 5_000,
|
||||||
})
|
})
|
||||||
.toContain(`themeColor = "${userThemeColor}"`)
|
.toContain(`themeColor = "${userThemeColor}"`)
|
||||||
// Only close the button after we've confirmed
|
|
||||||
})
|
})
|
||||||
|
|
||||||
await test.step('Set project theme color', async () => {
|
await test.step('Set project theme color', async () => {
|
||||||
|
@ -22,6 +22,8 @@ import usePlatform from 'hooks/usePlatform'
|
|||||||
import { FileEntry } from 'lib/project'
|
import { FileEntry } from 'lib/project'
|
||||||
import { useFileSystemWatcher } from 'hooks/useFileSystemWatcher'
|
import { useFileSystemWatcher } from 'hooks/useFileSystemWatcher'
|
||||||
import { normalizeLineEndings } from 'lib/codeEditor'
|
import { normalizeLineEndings } from 'lib/codeEditor'
|
||||||
|
import { toSync } from 'lib/utils'
|
||||||
|
import { reportRejection } from 'lib/trap'
|
||||||
|
|
||||||
function getIndentationCSS(level: number) {
|
function getIndentationCSS(level: number) {
|
||||||
return `calc(1rem * ${level + 1})`
|
return `calc(1rem * ${level + 1})`
|
||||||
@ -241,7 +243,7 @@ const FileTreeItem = ({
|
|||||||
// Show the renaming form
|
// Show the renaming form
|
||||||
addCurrentItemToRenaming()
|
addCurrentItemToRenaming()
|
||||||
} else if (e.code === 'Space') {
|
} else if (e.code === 'Space') {
|
||||||
void handleClick()
|
toSync(handleClick, reportRejection)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,7 +294,7 @@ const FileTreeItem = ({
|
|||||||
style={{ paddingInlineStart: getIndentationCSS(level) }}
|
style={{ paddingInlineStart: getIndentationCSS(level) }}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.currentTarget.focus()
|
e.currentTarget.focus()
|
||||||
void handleClick()
|
toSync(handleClick, reportRejection)
|
||||||
}}
|
}}
|
||||||
onKeyUp={handleKeyUp}
|
onKeyUp={handleKeyUp}
|
||||||
>
|
>
|
||||||
|
@ -8,7 +8,6 @@ import {
|
|||||||
VariableDeclaration,
|
VariableDeclaration,
|
||||||
VariableDeclarator,
|
VariableDeclarator,
|
||||||
sketchFromKclValue,
|
sketchFromKclValue,
|
||||||
recast,
|
|
||||||
} from '../wasm'
|
} from '../wasm'
|
||||||
import {
|
import {
|
||||||
createCallExpressionStdLib,
|
createCallExpressionStdLib,
|
||||||
@ -260,9 +259,7 @@ async function updateAstAndFocus(
|
|||||||
focusPath: pathToFilletNode,
|
focusPath: pathToFilletNode,
|
||||||
})
|
})
|
||||||
|
|
||||||
const newCode = recast(updatedAst.newAst)
|
await codeManager.updateEditorWithAstAndWriteToFile(updatedAst.newAst)
|
||||||
if (err(newCode)) return
|
|
||||||
await codeManager.updateCodeEditor(newCode)
|
|
||||||
|
|
||||||
if (updatedAst?.selections) {
|
if (updatedAst?.selections) {
|
||||||
editorManager.selectRange(updatedAst?.selections)
|
editorManager.selectRange(updatedAst?.selections)
|
||||||
|
@ -533,7 +533,8 @@ export const modelingMachine = setup({
|
|||||||
}
|
}
|
||||||
),
|
),
|
||||||
'hide default planes': () => {
|
'hide default planes': () => {
|
||||||
void kclManager.hidePlanes()
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||||
|
kclManager.hidePlanes()
|
||||||
},
|
},
|
||||||
'reset sketch metadata': assign({
|
'reset sketch metadata': assign({
|
||||||
sketchDetails: null,
|
sketchDetails: null,
|
||||||
@ -541,7 +542,8 @@ export const modelingMachine = setup({
|
|||||||
sketchPlaneId: '',
|
sketchPlaneId: '',
|
||||||
}),
|
}),
|
||||||
'reset camera position': () => {
|
'reset camera position': () => {
|
||||||
void engineCommandManager.sendSceneCommand({
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||||
|
engineCommandManager.sendSceneCommand({
|
||||||
type: 'modeling_cmd_req',
|
type: 'modeling_cmd_req',
|
||||||
cmd_id: uuidv4(),
|
cmd_id: uuidv4(),
|
||||||
cmd: {
|
cmd: {
|
||||||
@ -699,8 +701,8 @@ export const modelingMachine = setup({
|
|||||||
)
|
)
|
||||||
if (err(applyFilletToSelectionResult)) return applyFilletToSelectionResult
|
if (err(applyFilletToSelectionResult)) return applyFilletToSelectionResult
|
||||||
|
|
||||||
console.log(applyFilletToSelectionResult)
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||||
void codeManager.updateEditorWithAstAndWriteToFile(kclManager.ast)
|
codeManager.updateEditorWithAstAndWriteToFile(kclManager.ast)
|
||||||
},
|
},
|
||||||
'set selection filter to curves only': () => {
|
'set selection filter to curves only': () => {
|
||||||
;(async () => {
|
;(async () => {
|
||||||
@ -758,7 +760,8 @@ export const modelingMachine = setup({
|
|||||||
'set up draft line': ({ context: { sketchDetails } }) => {
|
'set up draft line': ({ context: { sketchDetails } }) => {
|
||||||
if (!sketchDetails) return
|
if (!sketchDetails) return
|
||||||
|
|
||||||
void sceneEntitiesManager
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||||
|
sceneEntitiesManager
|
||||||
.setupDraftSegment(
|
.setupDraftSegment(
|
||||||
sketchDetails.sketchPathToNode,
|
sketchDetails.sketchPathToNode,
|
||||||
sketchDetails.zAxis,
|
sketchDetails.zAxis,
|
||||||
@ -772,7 +775,9 @@ export const modelingMachine = setup({
|
|||||||
},
|
},
|
||||||
'set up draft arc': ({ context: { sketchDetails } }) => {
|
'set up draft arc': ({ context: { sketchDetails } }) => {
|
||||||
if (!sketchDetails) return
|
if (!sketchDetails) return
|
||||||
void sceneEntitiesManager
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||||
|
sceneEntitiesManager
|
||||||
.setupDraftSegment(
|
.setupDraftSegment(
|
||||||
sketchDetails.sketchPathToNode,
|
sketchDetails.sketchPathToNode,
|
||||||
sketchDetails.zAxis,
|
sketchDetails.zAxis,
|
||||||
@ -841,7 +846,8 @@ export const modelingMachine = setup({
|
|||||||
if (event.type !== 'Add rectangle origin') return
|
if (event.type !== 'Add rectangle origin') return
|
||||||
if (!sketchDetails || !event.data) return
|
if (!sketchDetails || !event.data) return
|
||||||
|
|
||||||
void sceneEntitiesManager
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||||
|
sceneEntitiesManager
|
||||||
.setupDraftRectangle(
|
.setupDraftRectangle(
|
||||||
sketchDetails.sketchPathToNode,
|
sketchDetails.sketchPathToNode,
|
||||||
sketchDetails.zAxis,
|
sketchDetails.zAxis,
|
||||||
@ -857,7 +863,8 @@ export const modelingMachine = setup({
|
|||||||
if (event.type !== 'Add circle origin') return
|
if (event.type !== 'Add circle origin') return
|
||||||
if (!sketchDetails || !event.data) return
|
if (!sketchDetails || !event.data) return
|
||||||
|
|
||||||
void sceneEntitiesManager
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||||
|
sceneEntitiesManager
|
||||||
.setupDraftCircle(
|
.setupDraftCircle(
|
||||||
sketchDetails.sketchPathToNode,
|
sketchDetails.sketchPathToNode,
|
||||||
sketchDetails.zAxis,
|
sketchDetails.zAxis,
|
||||||
@ -871,7 +878,9 @@ export const modelingMachine = setup({
|
|||||||
},
|
},
|
||||||
'set up draft line without teardown': ({ context: { sketchDetails } }) => {
|
'set up draft line without teardown': ({ context: { sketchDetails } }) => {
|
||||||
if (!sketchDetails) return
|
if (!sketchDetails) return
|
||||||
void sceneEntitiesManager
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||||
|
sceneEntitiesManager
|
||||||
.setupDraftSegment(
|
.setupDraftSegment(
|
||||||
sketchDetails.sketchPathToNode,
|
sketchDetails.sketchPathToNode,
|
||||||
sketchDetails.zAxis,
|
sketchDetails.zAxis,
|
||||||
@ -899,14 +908,17 @@ export const modelingMachine = setup({
|
|||||||
'add axis n grid': ({ context: { sketchDetails } }) => {
|
'add axis n grid': ({ context: { sketchDetails } }) => {
|
||||||
if (!sketchDetails) return
|
if (!sketchDetails) return
|
||||||
if (localStorage.getItem('disableAxis')) return
|
if (localStorage.getItem('disableAxis')) return
|
||||||
void sceneEntitiesManager.createSketchAxis(
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||||
|
sceneEntitiesManager.createSketchAxis(
|
||||||
sketchDetails.sketchPathToNode || [],
|
sketchDetails.sketchPathToNode || [],
|
||||||
sketchDetails.zAxis,
|
sketchDetails.zAxis,
|
||||||
sketchDetails.yAxis,
|
sketchDetails.yAxis,
|
||||||
sketchDetails.origin
|
sketchDetails.origin
|
||||||
)
|
)
|
||||||
|
|
||||||
void codeManager.updateEditorWithAstAndWriteToFile(kclManager.ast)
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||||
|
codeManager.updateEditorWithAstAndWriteToFile(kclManager.ast)
|
||||||
},
|
},
|
||||||
'reset client scene mouse handlers': () => {
|
'reset client scene mouse handlers': () => {
|
||||||
// when not in sketch mode we don't need any mouse listeners
|
// when not in sketch mode we don't need any mouse listeners
|
||||||
@ -936,7 +948,8 @@ export const modelingMachine = setup({
|
|||||||
if (event.type !== 'Delete segment') return
|
if (event.type !== 'Delete segment') return
|
||||||
if (!sketchDetails || !event.data) return
|
if (!sketchDetails || !event.data) return
|
||||||
|
|
||||||
void deleteSegment({
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||||
|
deleteSegment({
|
||||||
pathToNode: event.data,
|
pathToNode: event.data,
|
||||||
sketchDetails,
|
sketchDetails,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
|
Reference in New Issue
Block a user