Revert "Revert multi-profile (#4812)"

This reverts commit efe8089b08.
This commit is contained in:
Kurt Hutten Irev-Dev
2024-12-18 07:08:41 +11:00
parent 76e7d80a55
commit 1e9cf6f256
61 changed files with 3589 additions and 1278 deletions

View File

@ -2,8 +2,6 @@ import { CustomIconName } from 'components/CustomIcon'
import { DEV } from 'env'
import { commandBarMachine } from 'machines/commandBarMachine'
import {
canRectangleOrCircleTool,
isClosedSketch,
isEditingExistingSketch,
modelingMachine,
pipeHasCircle,
@ -73,7 +71,7 @@ export const toolbarConfig: Record<ToolbarModeName, ToolbarMode> = {
status: 'available',
disabled: (state) => !state.matches('idle'),
title: ({ sketchPathId }) =>
`${sketchPathId ? 'Edit' : 'Start'} Sketch`,
sketchPathId ? 'Edit Sketch' : 'Start Sketch',
showTitle: true,
hotkey: 'S',
description: 'Start drawing a 2D sketch',
@ -315,22 +313,14 @@ export const toolbarConfig: Record<ToolbarModeName, ToolbarMode> = {
{
id: 'line',
onClick: ({ modelingState, modelingSend }) => {
if (modelingState.matches({ Sketch: { 'Line tool': 'No Points' } })) {
// Exit the sketch state if there are no points and they press ESC
modelingSend({
type: 'Cancel',
})
} else {
// Exit the tool if there are points and they press ESC
modelingSend({
type: 'change tool',
data: {
tool: !modelingState.matches({ Sketch: 'Line tool' })
? 'line'
: 'none',
},
})
}
modelingSend({
type: 'change tool',
data: {
tool: !modelingState.matches({ Sketch: 'Line tool' })
? 'line'
: 'none',
},
})
},
icon: 'line',
status: 'available',
@ -341,8 +331,7 @@ export const toolbarConfig: Record<ToolbarModeName, ToolbarMode> = {
}) ||
state.matches({
Sketch: { 'Circle tool': 'Awaiting Radius' },
}) ||
isClosedSketch(state.context),
}),
title: 'Line',
hotkey: (state) =>
state.matches({ Sketch: 'Line tool' }) ? ['Esc', 'L'] : 'L',
@ -422,10 +411,7 @@ export const toolbarConfig: Record<ToolbarModeName, ToolbarMode> = {
icon: 'circle',
status: 'available',
title: 'Center circle',
disabled: (state) =>
state.matches('Sketch no face') ||
(!canRectangleOrCircleTool(state.context) &&
!state.matches({ Sketch: 'Circle tool' })),
disabled: (state) => state.matches('Sketch no face'),
isActive: (state) => state.matches({ Sketch: 'Circle tool' }),
hotkey: (state) =>
state.matches({ Sketch: 'Circle tool' }) ? ['Esc', 'C'] : 'C',
@ -464,10 +450,7 @@ export const toolbarConfig: Record<ToolbarModeName, ToolbarMode> = {
}),
icon: 'rectangle',
status: 'available',
disabled: (state) =>
state.matches('Sketch no face') ||
(!canRectangleOrCircleTool(state.context) &&
!state.matches({ Sketch: 'Rectangle tool' })),
disabled: (state) => state.matches('Sketch no face'),
title: 'Corner rectangle',
hotkey: (state) =>
state.matches({ Sketch: 'Rectangle tool' }) ? ['Esc', 'R'] : 'R',
@ -490,10 +473,7 @@ export const toolbarConfig: Record<ToolbarModeName, ToolbarMode> = {
}),
icon: 'arc',
status: 'available',
disabled: (state) =>
state.matches('Sketch no face') ||
(!canRectangleOrCircleTool(state.context) &&
!state.matches({ Sketch: 'Center Rectangle tool' })),
disabled: (state) => state.matches('Sketch no face'),
title: 'Center rectangle',
hotkey: (state) =>
state.matches({ Sketch: 'Center Rectangle tool' })