From 284a153be023bb9f4c9add2d8f1dae03f5029996 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Wed, 19 Sep 2018 22:37:24 +0800 Subject: [PATCH] fix bug that treebox scroll_into_view wrongly calcuates a position --- source/gui/widgets/treebox.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/gui/widgets/treebox.cpp b/source/gui/widgets/treebox.cpp index 7719ffe7..30739d1c 100644 --- a/source/gui/widgets/treebox.cpp +++ b/source/gui/widgets/treebox.cpp @@ -644,7 +644,7 @@ namespace nana auto const short_side = (std::min)(pos, last_pos - pos); if (short_side >= capacity / 2) { - pos -= short_side; + pos = short_side - capacity / 2; } else { @@ -664,7 +664,10 @@ namespace nana auto prv_first = shape.first; shape.first = attr.tree_cont.advance_if(nullptr, pos, drawerbase::treebox::pred_allow_child{}); - + + //Update the position of scroll + show_scroll(); + return has_expanded || (prv_first != shape.first); }