* wip hack to delete line segments * unrelated: clean up console * better check if current selection is segment before deletion * lint
This commit is contained in:
@ -1967,8 +1967,27 @@ export const ModelingMachineProvider = ({
|
||||
// `navigator.platform` is deprecated, but the alternative `navigator.userAgentData.platform` is not reliable
|
||||
const deleteKeys =
|
||||
platform() === 'macos' ? ['backspace', 'delete', 'del'] : ['delete', 'del']
|
||||
|
||||
useHotkeys(deleteKeys, () => {
|
||||
// When the current selection is a segment, delete that directly ('Delete selection' doesn't support it)
|
||||
const segmentNodePaths = Object.keys(modelingState.context.segmentOverlays)
|
||||
const selections =
|
||||
modelingState.context.selectionRanges.graphSelections.filter((sel) =>
|
||||
segmentNodePaths.includes(JSON.stringify(sel.codeRef.pathToNode))
|
||||
)
|
||||
selections.forEach((selection) => {
|
||||
modelingSend({
|
||||
type: 'Delete segment',
|
||||
data: selection.codeRef.pathToNode,
|
||||
})
|
||||
})
|
||||
if (
|
||||
modelingState.context.selectionRanges.graphSelections.length >
|
||||
selections.length
|
||||
) {
|
||||
// Not all selection were segments -> keep the default delete behavior
|
||||
modelingSend({ type: 'Delete selection' })
|
||||
}
|
||||
})
|
||||
|
||||
// Allow ctrl+alt+c to center to selection
|
||||
|
@ -806,8 +806,6 @@ export const modelingMachine = setup({
|
||||
}),
|
||||
'set selection filter to curves only': () => {
|
||||
;(async () => {
|
||||
// This definitely runs but doesn't seem to have an effect
|
||||
console.log('>> set selection to curve only')
|
||||
await engineCommandManager.sendSceneCommand({
|
||||
type: 'modeling_cmd_req',
|
||||
cmd_id: uuidv4(),
|
||||
|
Reference in New Issue
Block a user