nana::listbox::scroll not scrolling to correct location(#322)

This commit is contained in:
Jinhao 2018-07-04 21:47:47 +08:00
parent 5a4edd2fef
commit 6add8868da

View File

@ -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<int>(off);
else if (last_off >= screen_px)
origin.y = static_cast<int>(last_off - screen_px);
else if (content_px >= screen_px)
origin.y = static_cast<int>(content_px - screen_px);
}
if (ess_->content_view->move_origin(origin - ess_->content_view->origin()))