diff options
author | Paulb23 <p_batty@hotmail.co.uk> | 2019-08-31 15:43:19 +0100 |
---|---|---|
committer | Paulb23 <p_batty@hotmail.co.uk> | 2019-08-31 15:43:19 +0100 |
commit | b1aaeb07ea57ea9881389b637f41ebd8883c06ed (patch) | |
tree | bfdb6d59acb27522cf22a0a8801c808b334f7b5a /scene/gui | |
parent | 4f6eb3610f70b2a73a19dd8b92fb03c4739ef25b (diff) |
Fix minimap drag when height is less then control size
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/text_edit.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 65554b1f5e..ab5ed3166c 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -596,8 +596,14 @@ void TextEdit::_update_minimap_drag() { return; } + int control_height = _get_control_height(); + int scroll_height = v_scroll->get_max() * (minimap_char_size.y + minimap_line_spacing); + if (control_height > scroll_height) { + control_height = scroll_height; + } + Point2 mp = get_local_mouse_position(); - double diff = (mp.y - minimap_scroll_click_pos) / _get_control_height(); + double diff = (mp.y - minimap_scroll_click_pos) / control_height; v_scroll->set_as_ratio(minimap_scroll_ratio + diff); } |