UI: ignore events in empty region overlap areas
- Resizable areas use 2D view bounds. - Header uses the button bounds. - A margin is added to avoid clicking between buttons. - Region resize edges clamp to the 2D view bounds. Resovles T61554
This commit is contained in:
@@ -403,6 +403,18 @@ void ED_region_generic_tools_region_message_subscribe(const struct bContext *C,
|
||||
struct wmMsgBus *mbus);
|
||||
int ED_region_generic_tools_region_snap_size(const struct ARegion *ar, int size, int axis);
|
||||
|
||||
/* area_query.c */
|
||||
bool ED_region_overlap_isect_x(const ARegion *ar, const int event_x);
|
||||
bool ED_region_overlap_isect_y(const ARegion *ar, const int event_y);
|
||||
bool ED_region_overlap_isect_xy(const ARegion *ar, const int event_xy[2]);
|
||||
bool ED_region_overlap_isect_x_with_margin(const ARegion *ar, const int event_x, const int margin);
|
||||
bool ED_region_overlap_isect_y_with_margin(const ARegion *ar, const int event_y, const int margin);
|
||||
bool ED_region_overlap_isect_xy_with_margin(const ARegion *ar,
|
||||
const int event_xy[2],
|
||||
const int margin);
|
||||
|
||||
bool ED_region_contains_xy(const struct ARegion *ar, const int event_xy[2]);
|
||||
|
||||
/* interface_region_hud.c */
|
||||
struct ARegionType *ED_area_type_hud(int space_type);
|
||||
void ED_area_type_hud_clear(struct wmWindowManager *wm, ScrArea *sa_keep);
|
||||
|
||||
@@ -86,6 +86,14 @@ typedef struct uiPopupBlockHandle uiPopupBlockHandle;
|
||||
#define UI_MAX_NAME_STR 128
|
||||
#define UI_MAX_SHORTCUT_STR 64
|
||||
|
||||
/**
|
||||
* For #ARegion.overlap regions, pass events though if they don't overlap
|
||||
* the regions contents (the usable part of the #View2D and buttons).
|
||||
*
|
||||
* The margin is needed so it's not possible to accidentally click inbetween buttons.
|
||||
*/
|
||||
#define UI_REGION_OVERLAP_MARGIN (U.widget_unit / 3)
|
||||
|
||||
/* use for clamping popups within the screen */
|
||||
#define UI_SCREEN_MARGIN 10
|
||||
|
||||
@@ -2302,6 +2310,7 @@ void UI_context_active_but_prop_get_templateID(struct bContext *C,
|
||||
struct ID *UI_context_active_but_get_tab_ID(struct bContext *C);
|
||||
|
||||
uiBut *UI_region_active_but_get(struct ARegion *ar);
|
||||
uiBut *UI_region_but_find_rect_over(const struct ARegion *ar, const struct rcti *isect);
|
||||
|
||||
/* uiFontStyle.align */
|
||||
typedef enum eFontStyle_Align {
|
||||
|
||||
@@ -117,6 +117,9 @@ enum eView2D_Gridlines {
|
||||
#define IN_2D_VERT_SCROLL(v2d, co) (BLI_rcti_isect_pt_v(&v2d->vert, co))
|
||||
#define IN_2D_HORIZ_SCROLL(v2d, co) (BLI_rcti_isect_pt_v(&v2d->hor, co))
|
||||
|
||||
#define IN_2D_VERT_SCROLL_RECT(v2d, rct) (BLI_rcti_isect(&v2d->vert, rct, NULL))
|
||||
#define IN_2D_HORIZ_SCROLL_RECT(v2d, rct) (BLI_rcti_isect(&v2d->hor, rct, NULL))
|
||||
|
||||
/* ------------------------------------------ */
|
||||
/* Type definitions: */
|
||||
|
||||
@@ -275,6 +278,13 @@ char UI_view2d_mouse_in_scrollers(const struct ARegion *ar,
|
||||
const struct View2D *v2d,
|
||||
int x,
|
||||
int y);
|
||||
char UI_view2d_rect_in_scrollers_ex(const struct ARegion *ar,
|
||||
const struct View2D *v2d,
|
||||
const struct rcti *rect,
|
||||
int *r_scroll);
|
||||
char UI_view2d_rect_in_scrollers(const struct ARegion *ar,
|
||||
const struct View2D *v2d,
|
||||
const struct rcti *rect);
|
||||
|
||||
/* cached text drawing in v2d, to allow pixel-aligned draw as post process */
|
||||
void UI_view2d_text_cache_add(
|
||||
|
||||
Reference in New Issue
Block a user