another scroll bug fixed

master
Allen Webster 2016-05-12 11:53:44 -04:00
parent 45592ab0f0
commit ff83917900
4 changed files with 24 additions and 23 deletions

View File

@ -147,7 +147,6 @@ do_feedback_message(System_Functions *system, Models *models, String value){
if (file){ if (file){
output_file_append(system, models, file, value, 1); output_file_append(system, models, file, value, 1);
i32 pos = buffer_size(&file->state.buffer); i32 pos = buffer_size(&file->state.buffer);
for (View_Iter iter = file_view_iter_init(&models->layout, file, 0); for (View_Iter iter = file_view_iter_init(&models->layout, file, 0);
file_view_iter_good(iter); file_view_iter_good(iter);

View File

@ -2823,29 +2823,31 @@ file_step(View *view, i32_Rect region, Input_Summary *user_input, b32 is_active)
f32 cursor_max_y = CursorMaxY(max_visible_y, line_height); f32 cursor_max_y = CursorMaxY(max_visible_y, line_height);
f32 cursor_min_y = CursorMinY(scroll_vars.min_y, line_height); f32 cursor_min_y = CursorMinY(scroll_vars.min_y, line_height);
if (!gui_id_eq(view->gui_target.active, gui_id_scrollbar())){
if (cursor_y > target_y + cursor_max_y){
target_y = cursor_y - cursor_max_y + delta_y;
}
if (cursor_y < target_y + cursor_min_y){
target_y = cursor_y - delta_y - cursor_min_y;
}
if (cursor_y > target_y + cursor_max_y){ if (target_y > scroll_vars.max_y) target_y = scroll_vars.max_y;
target_y = cursor_y - cursor_max_y + delta_y; if (target_y < scroll_vars.min_y) target_y = view->file_scroll.min_y;
}
if (cursor_y < target_y + cursor_min_y){ if (cursor_x < target_x){
target_y = cursor_y - delta_y - cursor_min_y; target_x = (f32)Max(0, cursor_x - max_x/2);
}
else if (cursor_x >= target_x + max_x){
target_x = (f32)(cursor_x - max_x/2);
}
if (target_x != scroll_vars.target_x || target_y != scroll_vars.target_y){
view->gui_target.scroll_updated.target_x = target_x;
view->gui_target.scroll_updated.target_y = target_y;
}
} }
if (target_y > scroll_vars.max_y) target_y = scroll_vars.max_y;
if (target_y < scroll_vars.min_y) target_y = view->file_scroll.min_y;
if (cursor_x < target_x){
target_x = (f32)Max(0, cursor_x - max_x/2);
}
else if (cursor_x >= target_x + max_x){
target_x = (f32)(cursor_x - max_x/2);
}
if (target_x != scroll_vars.target_x || target_y != scroll_vars.target_y){
view->gui_target.scroll_updated.target_x = target_x;
view->gui_target.scroll_updated.target_y = target_y;
}
if (file->state.paste_effect.tick_down > 0){ if (file->state.paste_effect.tick_down > 0){
--file->state.paste_effect.tick_down; --file->state.paste_effect.tick_down;
is_animating = 1; is_animating = 1;

View File

@ -1,4 +1,4 @@
Distribution Date: 10.05.2016 (dd.mm.yyyy) Distribution Date: 12.05.2016 (dd.mm.yyyy)
Thank you for contributing to the 4coder project! Thank you for contributing to the 4coder project!

View File

@ -1,4 +1,4 @@
Distribution Date: 10.05.2016 (dd.mm.yyyy) Distribution Date: 12.05.2016 (dd.mm.yyyy)
Thank you for contributing to the 4coder project! Thank you for contributing to the 4coder project!