Various tweaks to View2D code for handling of scrollbar interactions in relation to bug 19881:
* Clearly labelled the way that the scrollbar hiding works. Also see the report comments for an overview * Added another pair of flags for another one of the cases in which scrollbars should also get ignored; when the entire contents of the view are visible, a pair of flags is now set in the view2d data (instead of for the scrollers tempdata only) for detecting this case too * Fixed the potential for scrollbars without zoom handles shown to have those handles still considered. This still happened in the User Preferences window, but has now been disabled. -- These changes still don't solve the bug though. Currently after the scrollbar operator passes through, the Outliner's activate-selection operators still fail to start.
This commit is contained in:
@@ -731,7 +731,7 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *
|
||||
glScissor(ar->winrct.xmin + (rect.xmin-1), ar->winrct.ymin+(rect.ymin-1), (rect.xmax+1)-(rect.xmin-1), (rect.ymax+1)-(rect.ymin-1));
|
||||
|
||||
for (rgb=0; rgb<3; rgb++) {
|
||||
float *data;
|
||||
float *data = NULL;
|
||||
|
||||
if (rgb==0) data = hist->data_r;
|
||||
else if (rgb==1) data = hist->data_g;
|
||||
|
||||
@@ -4234,13 +4234,13 @@ static int ui_mouse_inside_region(ARegion *ar, int x, int y)
|
||||
mask_rct.ymin= v2d->mask.ymin;
|
||||
mask_rct.ymax= v2d->mask.ymax;
|
||||
|
||||
if (v2d->scroll & V2D_SCROLL_VERTICAL_HIDE) {
|
||||
if (v2d->scroll & (V2D_SCROLL_VERTICAL_HIDE|V2D_SCROLL_VERTICAL_FULLR)) {
|
||||
if (v2d->scroll & V2D_SCROLL_LEFT)
|
||||
mask_rct.xmin= v2d->vert.xmin;
|
||||
else if (v2d->scroll & V2D_SCROLL_RIGHT)
|
||||
mask_rct.xmax= v2d->vert.xmax;
|
||||
}
|
||||
if (v2d->scroll & V2D_SCROLL_HORIZONTAL_HIDE) {
|
||||
if (v2d->scroll & (V2D_SCROLL_HORIZONTAL_HIDE|V2D_SCROLL_HORIZONTAL_FULLR)) {
|
||||
if (v2d->scroll & (V2D_SCROLL_BOTTOM|V2D_SCROLL_BOTTOM_O))
|
||||
mask_rct.ymin= v2d->hor.ymin;
|
||||
else if (v2d->scroll & V2D_SCROLL_TOP)
|
||||
|
||||
@@ -62,7 +62,12 @@
|
||||
|
||||
/* *********************************************************************** */
|
||||
|
||||
/* helper to allow scrollbars to dynamically hide */
|
||||
/* helper to allow scrollbars to dynamically hide
|
||||
* - returns a copy of the scrollbar settings with the flags to display
|
||||
* horizontal/vertical scrollbars removed
|
||||
* - input scroll value is the v2d->scroll var
|
||||
* - hide flags are set per region at drawtime
|
||||
*/
|
||||
static int view2d_scroll_mapped(int scroll)
|
||||
{
|
||||
if(scroll & V2D_SCROLL_HORIZONTAL_HIDE)
|
||||
@@ -1411,10 +1416,14 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
|
||||
CLAMP(scrollers->hor_min, hor.xmin, hor.xmax-V2D_SCROLLER_HANDLE_SIZE);
|
||||
}
|
||||
|
||||
/* check whether sliders can disappear */
|
||||
/* check whether sliders can disappear due to the full-range being used */
|
||||
if(v2d->keeptot) {
|
||||
if(fac1 <= 0.0f && fac2 >= 1.0f)
|
||||
if ((fac1 <= 0.0f) && (fac2 >= 1.0f)) {
|
||||
v2d->scroll |= V2D_SCROLL_HORIZONTAL_FULLR;
|
||||
scrollers->horfull= 1;
|
||||
}
|
||||
else
|
||||
v2d->scroll &= ~V2D_SCROLL_HORIZONTAL_FULLR;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1448,10 +1457,14 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
|
||||
CLAMP(scrollers->vert_min, vert.ymin, vert.ymax-V2D_SCROLLER_HANDLE_SIZE);
|
||||
}
|
||||
|
||||
/* check whether sliders can disappear */
|
||||
/* check whether sliders can disappear due to the full-range being used */
|
||||
if(v2d->keeptot) {
|
||||
if(fac1 <= 0.0f && fac2 >= 1.0f)
|
||||
if ((fac1 <= 0.0f) && (fac2 >= 1.0f)) {
|
||||
v2d->scroll |= V2D_SCROLL_VERTICAL_FULLR;
|
||||
scrollers->vertfull= 1;
|
||||
}
|
||||
else
|
||||
v2d->scroll &= ~V2D_SCROLL_VERTICAL_FULLR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1414,6 +1414,18 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
scroller_activate_init(C, op, event, in_scroller);
|
||||
vsm= (v2dScrollerMove *)op->customdata;
|
||||
|
||||
/* check if zoom zones are inappropriate (i.e. zoom widgets not shown), so cannot continue
|
||||
* NOTE: see view2d.c for latest conditions, and keep this in sync with that
|
||||
*/
|
||||
if (ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) {
|
||||
if ( ((vsm->scroller=='h') && (v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL)==0) ||
|
||||
((vsm->scroller=='v') && (v2d->scroll & V2D_SCROLL_SCALE_VERTICAL)==0) )
|
||||
{
|
||||
/* switch to bar (i.e. no scaling gets handled) */
|
||||
vsm->zone= SCROLLHANDLE_BAR;
|
||||
}
|
||||
}
|
||||
|
||||
/* check if zone is inappropriate (i.e. 'bar' but panning is banned), so cannot continue */
|
||||
if (vsm->zone == SCROLLHANDLE_BAR) {
|
||||
if ( ((vsm->scroller=='h') && (v2d->keepofs & V2D_LOCKOFS_X)) ||
|
||||
@@ -1426,15 +1438,21 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
return OPERATOR_PASS_THROUGH;
|
||||
}
|
||||
}
|
||||
|
||||
/* zone is also inappropriate if scroller is not visible... */
|
||||
if ( ((vsm->scroller=='h') && (v2d->scroll & V2D_SCROLL_HORIZONTAL_HIDE)) ||
|
||||
((vsm->scroller=='v') && (v2d->scroll & V2D_SCROLL_VERTICAL_HIDE)) )
|
||||
if ( ((vsm->scroller=='h') && (v2d->scroll & (V2D_SCROLL_HORIZONTAL_HIDE|V2D_SCROLL_HORIZONTAL_FULLR))) ||
|
||||
((vsm->scroller=='v') && (v2d->scroll & (V2D_SCROLL_VERTICAL_HIDE|V2D_SCROLL_VERTICAL_FULLR))) )
|
||||
{
|
||||
/* free customdata initialised */
|
||||
scroller_activate_exit(C, op);
|
||||
|
||||
/* can't catch this event for ourselves, so let it go to someone else? */
|
||||
// FIXME: still this doesn't fall through to the item_activate callback for the outliner...
|
||||
return OPERATOR_PASS_THROUGH;
|
||||
}
|
||||
|
||||
if(vsm->scroller=='h')
|
||||
/* activate the scroller */
|
||||
if (vsm->scroller=='h')
|
||||
v2d->scroll_ui |= V2D_SCROLL_H_ACTIVE;
|
||||
else
|
||||
v2d->scroll_ui |= V2D_SCROLL_V_ACTIVE;
|
||||
|
||||
@@ -124,9 +124,12 @@ typedef struct View2D {
|
||||
#define V2D_SCROLL_SCALE_VERTICAL (1<<5)
|
||||
/* scale markings - horizontal */
|
||||
#define V2D_SCROLL_SCALE_HORIZONTAL (1<<6)
|
||||
/* disable draw temporary */
|
||||
/* induce hiding of scrollbars - set by region drawing in response to size of region */
|
||||
#define V2D_SCROLL_VERTICAL_HIDE (1<<7)
|
||||
#define V2D_SCROLL_HORIZONTAL_HIDE (1<<8)
|
||||
/* scrollbar extends beyond its available window - set when calculating scrollbars for drawing */
|
||||
#define V2D_SCROLL_VERTICAL_FULLR (1<<9)
|
||||
#define V2D_SCROLL_HORIZONTAL_FULLR (1<<10)
|
||||
|
||||
/* scroll_ui, activate flag for drawing */
|
||||
#define V2D_SCROLL_H_ACTIVE (1<<0)
|
||||
|
||||
Reference in New Issue
Block a user