Merge pull request #31828 from Paulb23/minimap_drag_less_then_control

Fix minimap drag when height is less then control size
This commit is contained in:
Rémi Verschelde 2019-08-31 22:09:53 +02:00 committed by GitHub
commit 00aabec8bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -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);
}