diff options
author | Valentin Zagura <puthre@gmail.com> | 2019-08-30 14:01:40 +0100 |
---|---|---|
committer | Valentin Zagura <puthre@gmail.com> | 2019-08-30 15:12:42 +0100 |
commit | a5ebed211f090ec5ef58114b4f95061487c3f8d6 (patch) | |
tree | b092c390a78ef92ec2869cea532999b9d7566e91 /editor | |
parent | 3db1d400458853bfa33c4605c819d368c11e4a57 (diff) |
Animation Bezier Editor: Extended zoom in and zoom out limits and fixed guide lines to accomodate sub unit steps and steps other than powers of 5
Diffstat (limited to 'editor')
-rw-r--r-- | editor/animation_bezier_editor.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp index 14ea18f885..76773a21b1 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -354,10 +354,12 @@ void AnimationBezierTrackEdit::_notification(int p_what) { { //guides float min_left_scale = font->get_height() + vsep; - float scale = 1; + float scale = (min_left_scale * 2) * v_zoom; + float step = Math::pow(10.0, Math::round(Math::log(scale / 5.0) / Math::log(10.0))) * 5.0; + scale = Math::stepify(scale, step); while (scale / v_zoom < min_left_scale * 2) { - scale *= 5; + scale += step; } bool first = true; @@ -378,7 +380,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) { draw_line(Point2(limit, i), Point2(right_limit, i), lc); Color c = color; c.a *= 0.5; - draw_string(font, Point2(limit + 8, i - 2), itos((iv + 1) * scale), c); + draw_string(font, Point2(limit + 8, i - 2), rtos(Math::stepify((iv + 1) * scale, step)), c); } first = false; @@ -631,7 +633,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) { if (mb->get_command()) { timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() * 1.05); } else { - if (v_zoom < 1000) { + if (v_zoom < 100000) { v_zoom *= 1.2; } } @@ -642,7 +644,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) { if (mb->get_command()) { timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() / 1.05); } else { - if (v_zoom > 0.01) { + if (v_zoom > 0.000001) { v_zoom /= 1.2; } } |