No user visible changes expected. The feature is not exposed yet. For the asset shelf (#102879), design is to use a paginated scrolling style. That means, that any scrolling will always snap to a multiple of the page size (the size used when pressing the Page Up/Down keys). Together with strict region size snapping (implemented in the asset shelf patch, #104831), this gives a clean scrolling experience where partially visible rows are avoided (impossible even). Introduces: - `View2D.flag` value `V2D_SNAP_TO_PAGESIZE_Y`, which will cause any scrolling to only use multiples of the page size. - A custom page size via `View2D.page_size_y` for when the full region size is not the appropriate page size value. - API function `UI_view2d_offset_y_snap_to_closest_page()` to enforce the snapping from outside View2D. The asset shelf uses this to keep strict scrolling over DPI changes. Pull Request: https://projects.blender.org/blender/blender/pulls/109154
44 lines
1.0 KiB
C++
44 lines
1.0 KiB
C++
/* SPDX-FileCopyrightText: 2023 Blender Foundation
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
/** \file
|
|
* \ingroup edinterface
|
|
*
|
|
* Share between view2d_*.cc files.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "DNA_vec_types.h"
|
|
|
|
struct bContext;
|
|
struct View2D;
|
|
|
|
struct View2DScrollers {
|
|
/* focus bubbles */
|
|
int vert_min, vert_max; /* vertical scroll-bar */
|
|
int hor_min, hor_max; /* horizontal scroll-bar */
|
|
|
|
/** Exact size of slider backdrop. */
|
|
rcti hor, vert;
|
|
};
|
|
|
|
/**
|
|
* Calculate relevant scroller properties.
|
|
*/
|
|
void view2d_scrollers_calc(View2D *v2d, const rcti *mask_custom, View2DScrollers *r_scrollers);
|
|
|
|
/**
|
|
* Change the size of the maximum viewable area (i.e. 'tot' rect).
|
|
*/
|
|
void view2d_totRect_set_resize(View2D *v2d, int width, int height, bool resize);
|
|
|
|
bool view2d_edge_pan_poll(bContext *C);
|
|
|
|
/**
|
|
* For paginated scrolling, get the page height to scroll. This may be a custom height
|
|
* (#View2D.page_size_y) but defaults to the #View2D.mask height.
|
|
*/
|
|
float view2d_page_size_y(const View2D &v2d);
|