Allow to resize the length of animations by dragging the timeline

This commit is contained in:
Michael Alexsander
2025-09-17 11:15:55 -03:00
parent 08705259f2
commit 2a10291f41
6 changed files with 202 additions and 108 deletions

View File

@@ -304,13 +304,23 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
const int v_separation = get_theme_constant(SNAME("h_separation"), SNAME("AnimationBezierTrackEdit"));
if (has_focus(true)) {
draw_rect(Rect2(Point2(), get_size()), focus_color, false, Math::round(EDSCALE));
draw_rect(Rect2(Point2(1, 1), get_size() - Point2(1, 1)), focus_color, false, Math::round(EDSCALE));
}
int right_limit = get_size().width;
// Unavailable timeline.
{
int px = (editor->get_current_animation()->get_length() - timeline->get_value()) * timeline->get_zoom_scale() + timeline->get_name_limit();
px = MAX(px, timeline->get_name_limit());
Rect2 rect = Rect2(px, 0, right_limit - px, get_size().height);
if (rect.size.width > 0) {
draw_rect(rect, Color(0, 0, 0, 0.2));
}
}
draw_line(Point2(limit, 0), Point2(limit, get_size().height), v_line_color, Math::round(EDSCALE));
int right_limit = get_size().width;
track_v_scroll_max = v_separation;
int vofs = v_separation + track_v_scroll;