Improve plotconfig add / remove behavior

This commit is contained in:
Matthias 2023-05-06 08:25:02 +02:00
parent 1c71ed5805
commit dc85902350

View File

@ -48,6 +48,10 @@ export const usePlotConfigStore = defineStore('plotConfig', {
},
deletePlotConfig(plotConfigName: string) {
delete this.customPlotConfigs[plotConfigName];
if (this.plotConfigName === plotConfigName) {
this.plotConfigName =
this.availablePlotConfigNames[this.availablePlotConfigNames.length - 1];
}
},
renamePlotConfig(oldName: string, newName: string) {
this.customPlotConfigs[newName] = this.customPlotConfigs[oldName];
@ -56,6 +60,7 @@ export const usePlotConfigStore = defineStore('plotConfig', {
},
newPlotConfig(plotConfigName: string) {
this.editablePlotConfig = deepClone(EMPTY_PLOTCONFIG);
this.saveCustomPlotConfig(plotConfigName, this.editablePlotConfig);
this.plotConfigName = plotConfigName;
},