diff options
author | Silc Renew <tokage.it.lab@gmail.com> | 2022-11-19 16:46:10 +0900 |
---|---|---|
committer | Silc Renew <tokage.it.lab@gmail.com> | 2022-11-19 16:46:10 +0900 |
commit | 3818be64a458df0e37011a6aa7e827f003e1995b (patch) | |
tree | ba184be2b47d152d7edda0cc2cc5791322734e3f /editor | |
parent | 84c404f6bcce9ba112118d77afd6bd70a92774d1 (diff) |
Fix the behavior of focus selection in bezier editor
Diffstat (limited to 'editor')
-rw-r--r-- | editor/animation_bezier_editor.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp index 4c7ebca299..af0c3fca5c 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -903,11 +903,17 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) { } float zoom_value = timeline->get_zoom()->get_max() - zv; - timeline->get_zoom()->set_value(zoom_value); - timeline->call_deferred("set_value", minimum_time); + if (Math::is_finite(minimum_time) && Math::is_finite(maximum_time) && maximum_time - minimum_time > CMP_EPSILON) { + timeline->get_zoom()->set_value(zoom_value); + timeline->call_deferred("set_value", minimum_time); + } - v_scroll = (maximum_value + minimum_value) / 2.0; - v_zoom = (maximum_value - minimum_value) / ((get_size().height - timeline->get_size().height) * 0.9); + if (Math::is_finite(minimum_value) && Math::is_finite(maximum_value)) { + v_scroll = (maximum_value + minimum_value) / 2.0; + if (maximum_value - minimum_value > CMP_EPSILON) { + v_zoom = (maximum_value - minimum_value) / ((get_size().height - timeline->get_size().height) * 0.9); + } + } queue_redraw(); accept_event(); |