UI: Hide Timeline Scrollbars When Very Short

If the Timeline is sized too short to show any of the scrubbing area,
then the scrollbars obscure the time line and current frame marker.
This PR hides the scrollbars in this case. Also for similar cases with
Dope Sheet, Graph Editor, and the embedded Graph Editor/DopeSheet in
Movie Clip Editor.

Pull Request: https://projects.blender.org/blender/blender/pulls/126806
This commit is contained in:
Harley Acheson
2024-08-27 21:18:10 +02:00
committed by Harley Acheson
parent 5eb80b1fa0
commit f40cd831fd
4 changed files with 28 additions and 18 deletions

View File

@@ -248,7 +248,9 @@ static void action_main_region_draw_overlay(const bContext *C, ARegion *region)
ED_time_scrub_draw_current_frame(region, scene, saction->flag & SACTION_DRAWTIME);
/* scrollers */
UI_view2d_scrollers_draw(v2d, nullptr);
if (region->winy > HEADERY * UI_SCALE_FAC) {
UI_view2d_scrollers_draw(v2d, nullptr);
}
}
/* add handlers, stuff you only do once or on area/region changes */

View File

@@ -873,8 +873,10 @@ static void graph_region_draw(const bContext *C, ARegion *region)
ED_time_scrub_draw_current_frame(region, scene, sc->flag & SC_SHOW_SECONDS);
/* scrollers */
const rcti scroller_mask = ED_time_scrub_clamp_scroller_mask(v2d->mask);
UI_view2d_scrollers_draw(v2d, &scroller_mask);
if (region->winy > HEADERY * UI_SCALE_FAC) {
const rcti scroller_mask = ED_time_scrub_clamp_scroller_mask(v2d->mask);
UI_view2d_scrollers_draw(v2d, &scroller_mask);
}
/* scale indicators */
{
@@ -924,7 +926,9 @@ static void dopesheet_region_draw(const bContext *C, ARegion *region)
ED_time_scrub_draw_current_frame(region, scene, sc->flag & SC_SHOW_SECONDS);
/* scrollers */
UI_view2d_scrollers_draw(v2d, nullptr);
if (region->winy > HEADERY * UI_SCALE_FAC) {
UI_view2d_scrollers_draw(v2d, nullptr);
}
}
static void clip_preview_region_draw(const bContext *C, ARegion *region)

View File

@@ -333,17 +333,19 @@ static void graph_main_region_draw_overlay(const bContext *C, ARegion *region)
ED_time_scrub_draw_current_frame(region, scene, sipo->flag & SIPO_DRAWTIME);
}
/* scrollers */
const rcti scroller_mask = ED_time_scrub_clamp_scroller_mask(v2d->mask);
/* FIXME: args for scrollers depend on the type of data being shown. */
UI_view2d_scrollers_draw(v2d, &scroller_mask);
if (region->winy > HEADERY * UI_SCALE_FAC) {
/* scrollers */
const rcti scroller_mask = ED_time_scrub_clamp_scroller_mask(v2d->mask);
/* FIXME: args for scrollers depend on the type of data being shown. */
UI_view2d_scrollers_draw(v2d, &scroller_mask);
/* scale numbers */
{
rcti rect;
BLI_rcti_init(
&rect, 0, 15 * UI_SCALE_FAC, 15 * UI_SCALE_FAC, region->winy - UI_TIME_SCRUB_MARGIN_Y);
UI_view2d_draw_scale_y__values(region, v2d, &rect, TH_SCROLL_TEXT);
/* scale numbers */
{
rcti rect;
BLI_rcti_init(
&rect, 0, 15 * UI_SCALE_FAC, 15 * UI_SCALE_FAC, region->winy - UI_TIME_SCRUB_MARGIN_Y);
UI_view2d_draw_scale_y__values(region, v2d, &rect, TH_SCROLL_TEXT);
}
}
}

View File

@@ -1964,8 +1964,10 @@ void draw_timeline_seq_display(const bContext *C, ARegion *region)
ED_time_scrub_draw_current_frame(region, scene, !(sseq->flag & SEQ_DRAWFRAMES));
const ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene));
SEQ_timeline_boundbox(scene, seqbase, &v2d->tot);
const rcti scroller_mask = ED_time_scrub_clamp_scroller_mask(v2d->mask);
UI_view2d_scrollers_draw(v2d, &scroller_mask);
if (region->winy > HEADERY * UI_SCALE_FAC) {
const ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene));
SEQ_timeline_boundbox(scene, seqbase, &v2d->tot);
const rcti scroller_mask = ED_time_scrub_clamp_scroller_mask(v2d->mask);
UI_view2d_scrollers_draw(v2d, &scroller_mask);
}
}