From c7709dca5128a618e887c39702dcdcbcd9688b40 Mon Sep 17 00:00:00 2001 From: Val Erastov Date: Mon, 28 Mar 2022 23:38:37 -0700 Subject: [PATCH] disable wizard selection cycling --- .../cad/craft/wizard/wizardSelectionPlugin.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/web/app/cad/craft/wizard/wizardSelectionPlugin.ts b/web/app/cad/craft/wizard/wizardSelectionPlugin.ts index 1cc836ff..c98afa35 100644 --- a/web/app/cad/craft/wizard/wizardSelectionPlugin.ts +++ b/web/app/cad/craft/wizard/wizardSelectionPlugin.ts @@ -37,7 +37,6 @@ export const WizardSelectionPlugin: Plugin { - console.log("DISPOSE!!!!"); wizardPickHandler = null; ctx.pickControlService.setPickHandler(null); }); @@ -106,23 +105,23 @@ function createPickHandlerFromSchema(wizardService: WizardService) { function select(entityRef: EntityReference, id: string) { const param = entityRef.field; - let paramToMakeActive = getNextActiveParam(entityRef); if (entityRef.isArray) { updateMulti(param.path, id); } else { updateSingle(param.path, id); } + let paramToMakeActive = getNextActiveParam(entityRef); wizardService.updateState(state => { state.activeParam = paramToMakeActive.field.flattenedPath }); } function getNextActiveParam(entityRef: EntityReference): EntityReference { - if (!entityRef.isArray) { - const index = schemaIndex.entities.indexOf(entityRef); - const nextIndex = (index + 1) % schemaIndex.entities.length; - return schemaIndex.entities[nextIndex]; - } + // if (!entityRef.isArray && entityRef.metadata.cycleSelection) { + // const index = schemaIndex.entities.indexOf(entityRef); + // const nextIndex = (index + 1) % schemaIndex.entities.length; + // return schemaIndex.entities[nextIndex]; + // } return entityRef; } @@ -134,9 +133,10 @@ function createPickHandlerFromSchema(wizardService: WizardService) { for (let eRef of schemaIndex.entities) { if (eRef.metadata.allowedKinds.includes(entity)) { select(eRef, id); + return true; } } - return true; + return false; } function deselectIfNeeded(id) {