diff --git a/src/app/components/basin-fieldset-container/basin-fieldset-container.component.ts b/src/app/components/basin-fieldset-container/basin-fieldset-container.component.ts index dd8b8f85450295ec6552bb7be8c74d14b8a6e709..63efc5a1f11bdd5acc45ffc726fd6668572996be 100644 --- a/src/app/components/basin-fieldset-container/basin-fieldset-container.component.ts +++ b/src/app/components/basin-fieldset-container/basin-fieldset-container.component.ts @@ -31,4 +31,9 @@ export class BasinFieldsetContainerComponent extends FieldsetContainerComponent protected addSubNub(after: FieldSet, clone?: boolean): void { this.predamService.copySelectedBasin(ServiceFactory.applicationSetupService.enableEmptyFieldsOnFormInit); } + + public onRemoveFieldset(fs: FieldSet) { + super.onRemoveFieldset(fs); + this.predamService.deleteSelected(ServiceFactory.applicationSetupService.enableEmptyFieldsOnFormInit); + } } diff --git a/src/app/components/pb-schema/pb-schema.component.ts b/src/app/components/pb-schema/pb-schema.component.ts index c258b98783f353aae60b26edbc0ecae2ed2df155..c335b4083a7111cbb9b745060fdb113511b3ee46 100644 --- a/src/app/components/pb-schema/pb-schema.component.ts +++ b/src/app/components/pb-schema/pb-schema.component.ts @@ -459,10 +459,6 @@ export class PbSchemaComponent implements AfterViewInit, AfterContentInit, OnIni /** Removes a basin or wall, and all related items */ public onRemoveClick() { this.predamService.deleteSelected(ServiceFactory.applicationSetupService.enableEmptyFieldsOnFormInit); - this.clearResults(); - this.unselect(); - this.refreshWithSelection(); - this.calculatorComponent.showPBInputData = true; } public get uitextRemove() { @@ -512,6 +508,13 @@ export class PbSchemaComponent implements AfterViewInit, AfterContentInit, OnIni this.refreshWithSelection(nub.uid); this.calculatorComponent.showPBInputData = true; break; + + case PrebarrageServiceEvents.BASIN_WALL_REMOVED: + this.clearResults(); + this.unselect(); + this.refreshWithSelection(); + this.calculatorComponent.showPBInputData = true; + break; } } diff --git a/src/app/services/prebarrage.service.ts b/src/app/services/prebarrage.service.ts index da22ff2f995fb22ee25512c6276ef02b615e3d4b..65e534627e3597e72c4345af7b19b3b73691f474 100644 --- a/src/app/services/prebarrage.service.ts +++ b/src/app/services/prebarrage.service.ts @@ -4,6 +4,7 @@ import { MermaidUtil, PbBassin, PbBassinParams, PbCloison, PreBarrage } from "ja export enum PrebarrageServiceEvents { BASIN_WALL_ADDED, // a wall has been added BASIN_WALL_COPIED, // a basin or wall has been copied + BASIN_WALL_REMOVED, // a basin or a wall has been removed } /** * service relatif au schéma de prébarrage @@ -67,6 +68,11 @@ export class PrebarrageService { this._model.addChild(new PbCloison(undefined, this._selectedNub.bassinAval, undefined, emptyFields)); } } + this._changeEventEmitter.emit( + { + id: PrebarrageServiceEvents.BASIN_WALL_REMOVED, + } + ); } private copyWall(wall: PbCloison, emptyFields: boolean): PbCloison {