VSE: Fix handle size calculation

Handle width calculation was incorrect in drawing code. This caused
handles to be invisible when zoomed out.

After fixing math, handles become too large, so now they are constrained
to quarter of strip width, which feels more natural and represents
clickable area more closely.

`sequence_handle_size_get_clamped()` did not return size in pixels, but
in 2D-View space, this comment was corrected.
This commit is contained in:
Richard Antalik 2021-07-01 23:16:37 +02:00
parent fd1fec5600
commit 7eecf77f0b
1 changed files with 3 additions and 3 deletions

View File

@ -453,13 +453,13 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1,
GPU_blend(GPU_BLEND_NONE);
}
/* Get handle width in pixels. */
/* Get handle width in 2d-View space. */
float sequence_handle_size_get_clamped(Sequence *seq, const float pixelx)
{
const float maxhandle = (pixelx * SEQ_HANDLE_SIZE) * U.pixelsize;
/* Ensure that handle is not wider, than half of strip. */
return min_ff(maxhandle, ((float)(seq->enddisp - seq->startdisp) / 2.0f) / pixelx);
/* Ensure that handle is not wider, than quarter of strip. */
return min_ff(maxhandle, ((float)(seq->enddisp - seq->startdisp) / 4.0f));
}
/* Draw a handle, on left or right side of strip. */