bug fix: nana::drawerbase::listbox::essence::where
This method incorrectly calculates the position of checkboxes in the listbox content area. It uses the formula `new_where.second * item_h + header_visible_px()` to calculate the number of pixels between the top of the viewport and a checkbox. The problem is that when the first visible item is only partially visible, `new_where.second * item_h` produces an excess of pixels equal to the vertical segment of the first visible item that is not in the viewport. This excess value produces a downward displacement of the calculated checkbox position, so it must be accounted for in the aforementioned formula. This problem occurs because at some point, the library switched from scrolling in item-sized increments to smooth scrolling (in older versions, it used to be that it was impossible for an item to be only partially visible). Relevant thread: http://nanapro.org/en-us/forum/index.php?u=/topic/1227/ggnana-listbox-with-a-check-box-for-each-list-item#post-3359
This commit is contained in:
parent
59d3a68485
commit
6c547276ec
@ -2387,7 +2387,9 @@ namespace nana
|
||||
nana::rectangle r;
|
||||
if (rect_lister(r))
|
||||
{
|
||||
auto top = new_where.second * item_h + header_visible_px();
|
||||
//potential displacement due to partially visible first visible item
|
||||
auto disp = origin.y - first_display().item * item_h;
|
||||
auto top = new_where.second * item_h + header_visible_px() - disp;
|
||||
if (checkarea(item_xpos(r), static_cast<int>(top)).is_hit(pos))
|
||||
new_where.first = parts::checker;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user