From 6add8868da61505e1db96fef2279a98c4a03fb1b Mon Sep 17 00:00:00 2001 From: Jinhao Date: Wed, 4 Jul 2018 21:47:47 +0800 Subject: [PATCH] nana::listbox::scroll not scrolling to correct location(#322) --- source/gui/widgets/listbox.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/gui/widgets/listbox.cpp b/source/gui/widgets/listbox.cpp index 3b41311d..e0c67f0a 100644 --- a/source/gui/widgets/listbox.cpp +++ b/source/gui/widgets/listbox.cpp @@ -2996,11 +2996,11 @@ namespace nana } else { - auto last_off = this->distance(this->first(), this->last()) * ess_->item_height(); - if (last_off - off >= screen_px) + auto const content_px = ess_->content_view->content_size().height; + if (content_px - off >= screen_px) origin.y = static_cast(off); - else if (last_off >= screen_px) - origin.y = static_cast(last_off - screen_px); + else if (content_px >= screen_px) + origin.y = static_cast(content_px - screen_px); } if (ess_->content_view->move_origin(origin - ess_->content_view->origin()))