Fix: Snap page scroll requires 1.5 page size drag distance to scroll from top to bottom #111520

Open
Guillermo Venegas wants to merge 1 commits from guishe/blender:fix-snap-pan-scroll into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
1 changed files with 3 additions and 4 deletions

View File

@ -54,15 +54,14 @@ static bool view2d_poll(bContext *C)
static float view2d_scroll_delta_y_snap_page_size(const View2D &v2d, const float delta_y)
{
const float page_size = view2d_page_size_y(v2d);
const int delta_pages = int((delta_y - page_size * 0.5f) / page_size);
/* Apply no change, don't update last coordinates. */
if (abs(delta_pages) < 1) {
/* Apply no change if delta is not at least half page size, don't update last coordinates. */
if ((page_size / 2) > fabs(delta_y)) {
return 0.0f;
}
/* Snap the delta to a multiple of a page size. */
return delta_pages * page_size;
return signf(delta_y) * page_size;
}
/** \} */