From 20dc6a31f4fd736df297c179df1825d48eb7f757 Mon Sep 17 00:00:00 2001 From: Jan Mulder Date: Mon, 29 Jan 2018 13:13:29 +0100 Subject: profile: replot handles while planning The settingsChanged() function of the profile widget tries to be clever and tries to prevent not needed replots of the profile. I'm not sure this is very relevant in the first place as change of settings are almost instantly, with or without replot. It appears that replot is always executed when there are calculated ceilings visible. But without calculated ceilings a replot is "optimized out". This does, however, introduce dangling divehandles in PLAN/EDIT and ADD mode of the profile, when any setting that influences the y-axis is changed. The fix is trivial. Just force a replot in the PLAN/EDIT and ADD modes. Fixes: #1070 Signed-off-by: Jan Mulder --- profile-widget/profilewidget2.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'profile-widget/profilewidget2.cpp') diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index b36d73da2..3a32263cc 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -801,7 +801,14 @@ void ProfileWidget2::settingsChanged() { // if we are showing calculated ceilings then we have to replot() // because the GF could have changed; otherwise we try to avoid replot() - bool needReplot = prefs.calcceiling; + // but always replot in PLAN/ADD/EDIT mode to avoid a bug of DiveHandlers not + // being redrawn on setting changes, causing them to become unattached + // to the profile + bool needReplot; + if (currentState == ADD || currentState == PLAN || currentState == EDIT) + needReplot = true; + else + needReplot = prefs.calcceiling; #ifndef SUBSURFACE_MOBILE gasYAxis->settingsChanged(); // Initialize ticks of partial pressure graph if ((prefs.percentagegraph||prefs.hrgraph) && PP_GRAPHS_ENABLED) { -- cgit v1.2.3-70-g09d2