diff --git a/modules/workbenches/modeler/features/extrude/extrude.operation.ts b/modules/workbenches/modeler/features/extrude/extrude.operation.ts index 758eef1f..72c6f50e 100644 --- a/modules/workbenches/modeler/features/extrude/extrude.operation.ts +++ b/modules/workbenches/modeler/features/extrude/extrude.operation.ts @@ -100,7 +100,6 @@ export const ExtrudeOperation: OperationDescriptor = { }, - form: [ { type: 'number', @@ -148,6 +147,8 @@ export const ExtrudeOperation: OperationDescriptor = { ], + defaultActiveField: 'face', + masking: [ { id: 'CUT', diff --git a/web/app/cad/craft/operationPlugin.ts b/web/app/cad/craft/operationPlugin.ts index d377b6d7..de51d020 100644 --- a/web/app/cad/craft/operationPlugin.ts +++ b/web/app/cad/craft/operationPlugin.ts @@ -135,6 +135,7 @@ export interface OperationDescriptor { previewGeomProvider?: (params: R) => OperationGeometryProvider, previewer?: any, form: FormDefinition | React.FunctionComponent, + defaultActiveField: string, schema?: OperationSchema, onParamsUpdate?: (params, name, value) => void, masking?: { diff --git a/web/app/cad/craft/wizard/components/form/Form.tsx b/web/app/cad/craft/wizard/components/form/Form.tsx index aea54fa5..2c92b087 100644 --- a/web/app/cad/craft/wizard/components/form/Form.tsx +++ b/web/app/cad/craft/wizard/components/form/Form.tsx @@ -26,7 +26,7 @@ export function Group({children}) { export function formField(Control) { return function FormPrimitive({label, name, active, setActive, ...props}) { - return + return ; @@ -52,10 +52,7 @@ export function attachToForm(Control): any { const fullPath = [...formPath, name]; const fullPathFlatten = flattenPath(fullPath); - const onChange = value => { - console.log(fullPath + " : " + value); - formEdit.onChange(fullPath, value); - } + const onChange = value => formEdit.onChange(fullPath, value); const setActive = (isActive) => formEdit.setActive(fullPathFlatten, isActive); const value = params[name]; diff --git a/web/app/cad/craft/wizard/wizardPlugin.ts b/web/app/cad/craft/wizard/wizardPlugin.ts index 5c96fb76..45fa8c46 100644 --- a/web/app/cad/craft/wizard/wizardPlugin.ts +++ b/web/app/cad/craft/wizard/wizardPlugin.ts @@ -89,8 +89,18 @@ export function activate(ctx: ApplicationContext) { if (old !== null && old.requestKey !== curr?.requestKey) { disposerList.call(); disposerList = createFunctionList(); - state$.next({}); } + + const newState: WizardState = {}; + + if (curr) { + const op = ctx.operationService.get(curr.type); + if (op.defaultActiveField) { + newState.activeParam = op.defaultActiveField; + } + } + + state$.next(newState); }) const updateParams = mutator => workingRequest$.update((req: WorkingRequest) => produce(req, draft => {