Compare commits
4 Commits
adjust-seg
...
pierremtb/
| Author | SHA1 | Date | |
|---|---|---|---|
| 737dd206cd | |||
| d7bd0c937d | |||
| d3b2483f4f | |||
| 7838b7c9fd |
@ -545,7 +545,8 @@ extrude002 = extrude(profile002, length = 150)
|
||||
expect(alreadyExportingToastMessage).not.toBeVisible(),
|
||||
])
|
||||
|
||||
await expect(successToastMessage).toHaveCount(2)
|
||||
const count = await successToastMessage.count()
|
||||
await expect(count).toBeGreaterThanOrEqual(2)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@ -151,6 +151,10 @@ export class KclManager {
|
||||
// These belonged to the previous file
|
||||
this.lastSuccessfulOperations = []
|
||||
this.lastSuccessfulVariables = {}
|
||||
|
||||
// Without this, when leaving a project which has errors and opening another project which doesn't,
|
||||
// you'd see the errors from the previous project for a short time until the new code is executed.
|
||||
this._errors = []
|
||||
}
|
||||
|
||||
get variables() {
|
||||
|
||||
@ -152,9 +152,10 @@ export function addSweep({
|
||||
|
||||
// Extra labeled args expressions
|
||||
const pathExpr = createLocalName(pathDeclaration.node.declaration.id.name)
|
||||
const sectionalExpr = sectional
|
||||
? [createLabeledArg('sectional', createLiteral(sectional))]
|
||||
: []
|
||||
const sectionalExpr =
|
||||
sectional == false
|
||||
? [createLabeledArg('sectional', createLiteral(sectional))]
|
||||
: []
|
||||
|
||||
const sketchesExpr = createSketchExpression(sketchesExprList)
|
||||
const call = createCallExpressionStdLibKw('sweep', sketchesExpr, [
|
||||
|
||||
@ -434,7 +434,7 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
|
||||
sectional: {
|
||||
inputType: 'options',
|
||||
skip: true,
|
||||
defaultValue: false,
|
||||
defaultValue: true,
|
||||
hidden: false,
|
||||
required: true,
|
||||
options: [
|
||||
|
||||
@ -290,7 +290,7 @@ export const sweepValidator = async ({
|
||||
const command = async () => {
|
||||
// TODO: second look on defaults here
|
||||
const DEFAULT_TOLERANCE: Models['LengthUnit_type'] = 1e-7
|
||||
const DEFAULT_SECTIONAL = false
|
||||
const DEFAULT_SECTIONAL = false // the more permissive for validation
|
||||
const cmdArgs = {
|
||||
target,
|
||||
trajectory,
|
||||
|
||||
@ -31,7 +31,7 @@ const save_ = async (file: ModelingAppFile, toastId: string) => {
|
||||
)
|
||||
toast.success(EXPORT_TOAST_MESSAGES.SUCCESS + ' [TEST]', {
|
||||
id: toastId,
|
||||
duration: 5_000,
|
||||
duration: 10_000,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
@ -139,18 +139,20 @@ export const settingsMachine = setup({
|
||||
return () => darkModeMatcher?.removeEventListener('change', listener)
|
||||
}),
|
||||
registerCommands: fromCallback<
|
||||
{ type: 'update' },
|
||||
{ type: 'update'; settings: SettingsType },
|
||||
{ settings: SettingsType; actor: AnyActorRef }
|
||||
>(({ input, receive, system }) => {
|
||||
// This assumes this actor is running in a system with a command palette
|
||||
const commandBarActor = system.get(ACTOR_IDS.COMMAND_BAR)
|
||||
// If the user wants to hide the settings commands
|
||||
//from the command bar don't add them.
|
||||
if (settings.commandBar.includeSettings.current === false) return
|
||||
if (settings.commandBar.includeSettings.current === false) {
|
||||
return
|
||||
}
|
||||
let commands: Command[] = []
|
||||
|
||||
const updateCommands = () =>
|
||||
settingsWithCommandConfigs(input.settings)
|
||||
const updateCommands = (newSettings: SettingsType) =>
|
||||
settingsWithCommandConfigs(newSettings)
|
||||
.map((type) =>
|
||||
createSettingsCommand({
|
||||
type,
|
||||
@ -175,14 +177,19 @@ export const settingsMachine = setup({
|
||||
data: { commands: commands },
|
||||
})
|
||||
|
||||
receive((event) => {
|
||||
if (event.type !== 'update') return
|
||||
receive(({ type, settings: newSettings }) => {
|
||||
if (type !== 'update') {
|
||||
return
|
||||
}
|
||||
removeCommands()
|
||||
commands = updateCommands()
|
||||
commands =
|
||||
newSettings.commandBar.includeSettings.current === false
|
||||
? []
|
||||
: updateCommands(newSettings)
|
||||
addCommands()
|
||||
})
|
||||
|
||||
commands = updateCommands()
|
||||
commands = updateCommands(settings)
|
||||
addCommands()
|
||||
|
||||
return () => {
|
||||
@ -205,7 +212,9 @@ export const settingsMachine = setup({
|
||||
const sceneInfra = rootContext.sceneInfra
|
||||
const sceneEntitiesManager = rootContext.sceneEntitiesManager
|
||||
|
||||
if (!sceneInfra || !sceneEntitiesManager) return
|
||||
if (!sceneInfra || !sceneEntitiesManager) {
|
||||
return
|
||||
}
|
||||
const opposingTheme = getOppositeTheme(context.app.theme.current)
|
||||
sceneInfra.theme = opposingTheme
|
||||
sceneEntitiesManager.updateSegmentBaseColor(opposingTheme)
|
||||
@ -213,13 +222,17 @@ export const settingsMachine = setup({
|
||||
setAllowOrbitInSketchMode: ({ context, self }) => {
|
||||
const rootContext = self.system.get('root').getSnapshot().context
|
||||
const sceneInfra = rootContext.sceneInfra
|
||||
if (!sceneInfra.camControls) return
|
||||
if (!sceneInfra.camControls) {
|
||||
return
|
||||
}
|
||||
sceneInfra.camControls._setting_allowOrbitInSketchMode =
|
||||
context.app.allowOrbitInSketchMode.current
|
||||
// ModelingMachineProvider will do a use effect to trigger the camera engine sync
|
||||
},
|
||||
toastSuccess: ({ event }) => {
|
||||
if (!('data' in event)) return
|
||||
if (!('data' in event)) {
|
||||
return
|
||||
}
|
||||
const eventParts = event.type.replace(/^set./, '').split('.') as [
|
||||
keyof typeof settings,
|
||||
string,
|
||||
@ -435,6 +448,22 @@ export const settingsMachine = setup({
|
||||
actions: ['setSettingAtLevel', 'setThemeColor'],
|
||||
},
|
||||
|
||||
'set.commandBar.includeSettings': {
|
||||
target: 'persisting settings',
|
||||
|
||||
actions: [
|
||||
'setSettingAtLevel',
|
||||
'toastSuccess',
|
||||
sendTo(
|
||||
'registerCommands',
|
||||
({ context: { currentProject: _, ...settings } }) => ({
|
||||
type: 'update',
|
||||
settings,
|
||||
})
|
||||
),
|
||||
],
|
||||
},
|
||||
|
||||
'set.modeling.defaultUnit': {
|
||||
target: 'persisting settings',
|
||||
|
||||
@ -497,6 +526,13 @@ export const settingsMachine = setup({
|
||||
'setClientTheme',
|
||||
'setAllowOrbitInSketchMode',
|
||||
'sendThemeToWatcher',
|
||||
sendTo(
|
||||
'registerCommands',
|
||||
({ context: { currentProject: _, ...settings } }) => ({
|
||||
type: 'update',
|
||||
settings,
|
||||
})
|
||||
),
|
||||
],
|
||||
},
|
||||
|
||||
@ -510,6 +546,13 @@ export const settingsMachine = setup({
|
||||
'setClientTheme',
|
||||
'setAllowOrbitInSketchMode',
|
||||
'sendThemeToWatcher',
|
||||
sendTo(
|
||||
'registerCommands',
|
||||
({ context: { currentProject: _, ...settings } }) => ({
|
||||
type: 'update',
|
||||
settings,
|
||||
})
|
||||
),
|
||||
],
|
||||
},
|
||||
|
||||
@ -529,7 +572,13 @@ export const settingsMachine = setup({
|
||||
'clearProjectSettings',
|
||||
'clearCurrentProject',
|
||||
'setThemeColor',
|
||||
sendTo('registerCommands', { type: 'update' }),
|
||||
sendTo(
|
||||
'registerCommands',
|
||||
({ context: { currentProject: _, ...settings } }) => ({
|
||||
type: 'update',
|
||||
settings,
|
||||
})
|
||||
),
|
||||
],
|
||||
},
|
||||
},
|
||||
@ -582,6 +631,13 @@ export const settingsMachine = setup({
|
||||
'setClientTheme',
|
||||
'setAllowOrbitInSketchMode',
|
||||
'sendThemeToWatcher',
|
||||
sendTo(
|
||||
'registerCommands',
|
||||
({ context: { currentProject: _, ...settings } }) => ({
|
||||
type: 'update',
|
||||
settings,
|
||||
})
|
||||
),
|
||||
],
|
||||
},
|
||||
onError: {
|
||||
@ -612,7 +668,13 @@ export const settingsMachine = setup({
|
||||
'setClientTheme',
|
||||
'setAllowOrbitInSketchMode',
|
||||
'sendThemeToWatcher',
|
||||
sendTo('registerCommands', { type: 'update' }),
|
||||
sendTo(
|
||||
'registerCommands',
|
||||
({ context: { currentProject: _, ...settings } }) => ({
|
||||
type: 'update',
|
||||
settings,
|
||||
})
|
||||
),
|
||||
],
|
||||
},
|
||||
onError: 'idle',
|
||||
|
||||
Reference in New Issue
Block a user