From 09f9a431cf619e2e6700d5b4169facbb71b7a7c1 Mon Sep 17 00:00:00 2001 From: ferdymercury Date: Fri, 5 Apr 2024 02:20:39 +0200 Subject: [PATCH] [gui] Do not reset FitPanel params when ADD on top of prefit function Fixes https://github.com/root-project/root/issues/11021 --- gui/fitpanel/src/TFitEditor.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gui/fitpanel/src/TFitEditor.cxx b/gui/fitpanel/src/TFitEditor.cxx index 5acfd98c9c685..128727d51e92d 100644 --- a/gui/fitpanel/src/TFitEditor.cxx +++ b/gui/fitpanel/src/TFitEditor.cxx @@ -2495,7 +2495,7 @@ void TFitEditor::DoFunction(Int_t selected) } else if (fConv->GetState() == kButtonDown) { - // If the normadd button is down don't replace the fEnteredFunc text + // If the conv button is down don't replace the fEnteredFunc text Int_t np = 0; TString s = ""; if (!strcmp(fEnteredFunc->GetText(), "")) @@ -2536,8 +2536,12 @@ void TFitEditor::DoFunction(Int_t selected) TF1* fitFunc = GetFitFunction(); //std::cout << "TFitEditor::DoFunction - using function " << fitFunc->GetName() << " " << fitFunc << std::endl; - if ( fitFunc && (unsigned int) fitFunc->GetNpar() != fFuncPars.size() ) - fFuncPars.clear(); + if ( fitFunc && (unsigned int) fitFunc->GetNpar() != fFuncPars.size() ) { + if (fAdd->GetState() == kButtonDown || fNormAdd->GetState() == kButtonDown || fConv->GetState() == kButtonDown) + fFuncPars.resize(fitFunc->GetNpar()); + else + fFuncPars.clear(); + } if ( fitFunc ) { //std::cout << "TFitEditor::DoFunction - deleting function " << fitFunc->GetName() << " " << fitFunc << std::endl; delete fitFunc;