@@ -1054,6 +1054,7 @@ void Plot_renderer::render()
10541054 return ;
10551055 }
10561056
1057+ const bool prev_v_auto = m_impl->last_range_v_auto ;
10571058 float v0 = 0 .0f ;
10581059 float v1 = 0 .0f ;
10591060 float preview_v0 = 0 .0f ;
@@ -1201,14 +1202,22 @@ void Plot_renderer::render()
12011202 const float target_preview_v1 = preview_v1;
12021203 const auto anim_now = std::chrono::steady_clock::now ();
12031204 if (!m_impl->anim_initialized ) {
1204- // When v_auto transitions from false to true, initialize animation
1205- // from the manual range (what the user was viewing) to provide a
1206- // smooth transition back to auto range.
1207- const float manual_v0 = m_impl->snapshot .cfg .v_manual_min ;
1208- const float manual_v1 = m_impl->snapshot .cfg .v_manual_max ;
1209- if (std::isfinite (manual_v0) && std::isfinite (manual_v1) && manual_v0 < manual_v1) {
1210- m_impl->anim_v0 = manual_v0;
1211- m_impl->anim_v1 = manual_v1;
1205+ const bool auto_just_enabled = v_auto && !prev_v_auto;
1206+ if (auto_just_enabled) {
1207+ // When v_auto transitions from false to true, initialize
1208+ // animation from the manual range (what the user was viewing)
1209+ // to provide a smooth transition back to auto range.
1210+ const float manual_v0 = m_impl->snapshot .cfg .v_manual_min ;
1211+ const float manual_v1 = m_impl->snapshot .cfg .v_manual_max ;
1212+ if (std::isfinite (manual_v0) && std::isfinite (manual_v1) &&
1213+ manual_v0 < manual_v1)
1214+ {
1215+ m_impl->anim_v0 = manual_v0;
1216+ m_impl->anim_v1 = manual_v1;
1217+ } else {
1218+ m_impl->anim_v0 = v0;
1219+ m_impl->anim_v1 = v1;
1220+ }
12121221 } else {
12131222 m_impl->anim_v0 = v0;
12141223 m_impl->anim_v1 = v1;
0 commit comments