From bf3af190c3c3cdba5351e172ac328c0dbda40061 Mon Sep 17 00:00:00 2001 From: "ocean (they/them)" Date: Mon, 29 May 2023 15:09:44 -0400 Subject: [PATCH] Increase vertical size of `CurveEdit` when `Inspector` widens This should allow users to edit points in a less constrained space, which feels like a UX improvement. That said, changing minimum size according to current size might be a hack that causes issues in certain situations. --- editor/plugins/curve_editor_plugin.cpp | 5 ++++- editor/plugins/curve_editor_plugin.h | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index 6228faaa727..6b5b0f92149 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -105,7 +105,7 @@ void CurveEdit::set_snap_count(int p_snap_count) { } Size2 CurveEdit::get_minimum_size() const { - return Vector2(64, 135) * EDSCALE; + return Vector2(64, MAX(135, get_size().x * ASPECT_RATIO)) * EDSCALE; } void CurveEdit::_notification(int p_what) { @@ -986,6 +986,9 @@ void CurveEditor::_notification(int p_what) { snap_count_edit->set_value(curve->get_meta("_snap_count", DEFAULT_SNAP)); } } break; + case NOTIFICATION_RESIZED: + curve_editor_rect->update_minimum_size(); + break; } } diff --git a/editor/plugins/curve_editor_plugin.h b/editor/plugins/curve_editor_plugin.h index b8d24c5cbc5..b6a74d9b93b 100644 --- a/editor/plugins/curve_editor_plugin.h +++ b/editor/plugins/curve_editor_plugin.h @@ -104,6 +104,8 @@ private: void _redraw(); private: + const float ASPECT_RATIO = 6.f / 13.f; + Transform2D _world_to_view; Ref curve;