diff --git a/source/blender/editors/space_sequencer/sequencer_intern.hh b/source/blender/editors/space_sequencer/sequencer_intern.hh index 90dab59a585..9f7978947e4 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.hh +++ b/source/blender/editors/space_sequencer/sequencer_intern.hh @@ -141,7 +141,7 @@ int sequencer_draw_get_transform_preview_frame(Scene *scene); void sequencer_special_update_set(Strip *strip); /* Get handle width in 2d-View space. */ -float sequence_handle_size_get_clamped(const Scene *scene, Strip *strip, float pixelx); +float strip_handle_draw_size_get(const Scene *scene, Strip *strip, float pixelx); /* UNUSED */ /* void seq_reset_imageofs(SpaceSeq *sseq); */ diff --git a/source/blender/editors/space_sequencer/sequencer_select.cc b/source/blender/editors/space_sequencer/sequencer_select.cc index 1644fc0aa2a..b1582f1386e 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.cc +++ b/source/blender/editors/space_sequencer/sequencer_select.cc @@ -897,8 +897,13 @@ static void select_linked_time(const Scene *scene, } } -/* Similar to `sequence_handle_size_get_clamped()` but allows for larger clickable area. */ -static float clickable_handle_size_get(const Scene *scene, const Strip *strip, const View2D *v2d) +/* Similar to `strip_handle_draw_size_get()`, but returns a larger clickable area that is + * the same for a given zoom level no matter whether "simplified tweaking" is turned off or on. + * `strip_clickable_areas_get` will pad this past strip bounds by 1/3 of the inner handle size, + * making the full handle size either 15 + 5 = 20px or 1/4 + 1/12 = 1/3 of the strip size. */ +static float inner_clickable_handle_size_get(const Scene *scene, + const Strip *strip, + const View2D *v2d) { const float pixelx = 1 / UI_view2d_scale_get_x(v2d); const float strip_len = SEQ_time_right_handle_frame_get(scene, strip) - @@ -918,6 +923,10 @@ bool ED_sequencer_can_select_handle(const Scene *scene, const Strip *strip, cons return false; } + /* This ensures clickable handles are deactivated when the strip gets too small (25 or 15 + * frames). Since the full handle size for a small strip is 1/3 of the strip size (see + * `inner_clickable_handle_size_get`), this means handles cannot be smaller than 25/3 = 8px for + * simple tweaking, 15/3 = 5px for legacy behavior. */ int min_len = 25 * U.pixelsize; if ((U.sequencer_editor_flag & USER_SEQ_ED_SIMPLE_TWEAKING) == 0) { min_len = 15 * U.pixelsize; @@ -929,6 +938,11 @@ bool ED_sequencer_can_select_handle(const Scene *scene, const Strip *strip, cons if (strip_len / pixelx < min_len) { return false; } + + if (UI_view2d_scale_get_y(v2d) < 16 * U.pixelsize) { + return false; + } + return true; } @@ -943,11 +957,11 @@ static void strip_clickable_areas_get(const Scene *scene, *r_left_handle = *r_body; *r_right_handle = *r_body; - const float handsize = clickable_handle_size_get(scene, strip, v2d); - BLI_rctf_pad(r_left_handle, handsize / 3, 0.0f); - BLI_rctf_pad(r_right_handle, handsize / 3, 0.0f); + const float handsize = inner_clickable_handle_size_get(scene, strip, v2d); r_left_handle->xmax = r_body->xmin + handsize; r_right_handle->xmin = r_body->xmax - handsize; + BLI_rctf_pad(r_left_handle, handsize / 3, 0.0f); + BLI_rctf_pad(r_right_handle, handsize / 3, 0.0f); BLI_rctf_pad(r_body, -handsize, 0.0f); } @@ -2046,9 +2060,8 @@ static int sequencer_box_select_exec(bContext *C, wmOperator *op) strip_rectf(scene, strip, &rq); if (BLI_rctf_isect(&rq, &rectf, nullptr)) { if (handles) { - /* Get the handles draw size. */ - float pixelx = BLI_rctf_size_x(&v2d->cur) / BLI_rcti_size_x(&v2d->mask); - float handsize = sequence_handle_size_get_clamped(scene, strip, pixelx) * 4; + /* Get the clickable handle size, ignoring padding. */ + float handsize = inner_clickable_handle_size_get(scene, strip, v2d) * 4; /* Right handle. */ if (rectf.xmax > (SEQ_time_right_handle_frame_get(scene, strip) - handsize)) { diff --git a/source/blender/editors/space_sequencer/sequencer_timeline_draw.cc b/source/blender/editors/space_sequencer/sequencer_timeline_draw.cc index 653d31abf08..582ed893804 100644 --- a/source/blender/editors/space_sequencer/sequencer_timeline_draw.cc +++ b/source/blender/editors/space_sequencer/sequencer_timeline_draw.cc @@ -234,7 +234,7 @@ static StripDrawContext strip_draw_context_get(TimelineDrawContext *ctx, Strip * !strip_ctx.can_draw_strip_content); strip_ctx.is_active_strip = strip == SEQ_select_active_get(scene); strip_ctx.is_single_image = SEQ_transform_single_image_check(strip); - strip_ctx.handle_width = sequence_handle_size_get_clamped(ctx->scene, strip, ctx->pixelx); + strip_ctx.handle_width = strip_handle_draw_size_get(ctx->scene, strip, ctx->pixelx); strip_ctx.show_strip_color_tag = (ctx->sseq->timeline_overlay.flag & SEQ_TIMELINE_SHOW_STRIP_COLOR_TAG); @@ -772,7 +772,7 @@ static void draw_handle_transform_text(const TimelineDrawContext *timeline_ctx, UI_view2d_text_cache_add(timeline_ctx->v2d, text_x, text_y, numstr, numstr_len, col); } -float sequence_handle_size_get_clamped(const Scene *scene, Strip *strip, const float pixelx) +float strip_handle_draw_size_get(const Scene *scene, Strip *strip, const float pixelx) { const bool use_thin_handle = (U.sequencer_editor_flag & USER_SEQ_ED_SIMPLE_TWEAKING) != 0; const float handle_size = use_thin_handle ? 5.0f : 8.0f; diff --git a/source/blender/editors/space_sequencer/space_sequencer.cc b/source/blender/editors/space_sequencer/space_sequencer.cc index ea1f7383282..fe68aea4184 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.cc +++ b/source/blender/editors/space_sequencer/space_sequencer.cc @@ -707,9 +707,7 @@ static void sequencer_main_cursor(wmWindow *win, ScrArea *area, ARegion *region) return; } - const float scale_y = UI_view2d_scale_get_y(v2d); - - if (!ED_sequencer_can_select_handle(scene, selection.seq1, v2d) || scale_y < 16 * U.pixelsize) { + if (!ED_sequencer_can_select_handle(scene, selection.seq1, v2d)) { WM_cursor_set(win, wmcursor); return; }