diff options
| author | Rémi Verschelde | 2018-03-13 11:40:31 +0100 |
|---|---|---|
| committer | GitHub | 2018-03-13 11:40:31 +0100 |
| commit | a64f30536ef256cf031dca3c5a1a715424c7b94e (patch) | |
| tree | b7ad36163fef69435e77fed4976b374e207672d7 | |
| parent | 9cadef3ffbd6a952e150235c370825b6ffa6a817 (diff) | |
| parent | c223fac83be5b5be3143e17819ad0179389407f9 (diff) | |
| download | godot-a64f30536ef256cf031dca3c5a1a715424c7b94e.tar.gz godot-a64f30536ef256cf031dca3c5a1a715424c7b94e.tar.zst godot-a64f30536ef256cf031dca3c5a1a715424c7b94e.zip | |
| -rw-r--r-- | editor/animation_editor.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/editor/animation_editor.cpp b/editor/animation_editor.cpp index 109081bc2..61a35f7a4 100644 --- a/editor/animation_editor.cpp +++ b/editor/animation_editor.cpp @@ -1266,8 +1266,21 @@ void AnimationKeyEditor::_track_editor_draw() { int decimals = 2; bool step_found = false; + const int period_width = font->get_char_size('.').width; + int max_digit_width = font->get_char_size('0').width; + for (int i = 1; i <= 9; i++) { + const int digit_width = font->get_char_size('0' + i).width; + max_digit_width = MAX(digit_width, max_digit_width); + } + const int max_sc = int(Math::ceil(zoomw / scale)); + const int max_sc_width = String::num(max_sc).length() * max_digit_width; + while (!step_found) { + min = max_sc_width; + if (decimals > 0) + min += period_width + max_digit_width * decimals; + static const int _multp[3] = { 1, 2, 5 }; for (int i = 0; i < 3; i++) { |
