remove overlapped sections, need floating sections instead
parent
0f3f7ce05b
commit
43f65dd5ef
|
@ -17,7 +17,7 @@ struct GUI_Scroll_Vars{
|
|||
float scroll_y;
|
||||
float target_y;
|
||||
float prev_target_y;
|
||||
float min_y, max_y;
|
||||
float max_y;
|
||||
|
||||
float scroll_x;
|
||||
float target_x;
|
||||
|
|
44
4ed.cpp
44
4ed.cpp
|
@ -415,10 +415,9 @@ COMMAND_DECL(center_view){
|
|||
else{
|
||||
y = view->recent->cursor.wrapped_y;
|
||||
}
|
||||
|
||||
|
||||
h = view_file_height(view);
|
||||
y -= h * .5f;
|
||||
if (y < view->recent->scroll.min_y) y = view->recent->scroll.min_y;
|
||||
y = clamp_bottom(0.f, y - h*.5f);
|
||||
|
||||
view->recent->scroll.target_y = y;
|
||||
}
|
||||
|
@ -1362,7 +1361,7 @@ COMMAND_DECL(move_down){
|
|||
USE_MODELS(models);
|
||||
REQ_READABLE_VIEW(view);
|
||||
REQ_FILE(file, view);
|
||||
|
||||
|
||||
f32 font_height = (f32)get_font_info(models->font_set, models->global_font.font_id)->height;
|
||||
f32 cy = view_get_cursor_y(view)+font_height;
|
||||
f32 px = view->recent->preferred_x;
|
||||
|
@ -1373,7 +1372,7 @@ COMMAND_DECL(move_down){
|
|||
COMMAND_DECL(seek_end_of_line){
|
||||
REQ_READABLE_VIEW(view);
|
||||
REQ_FILE(file, view);
|
||||
|
||||
|
||||
i32 pos = view_find_end_of_line(view, view->recent->cursor.pos);
|
||||
view_cursor_move(view, pos);
|
||||
}
|
||||
|
@ -1381,48 +1380,47 @@ COMMAND_DECL(seek_end_of_line){
|
|||
COMMAND_DECL(seek_beginning_of_line){
|
||||
REQ_READABLE_VIEW(view);
|
||||
REQ_FILE(file, view);
|
||||
|
||||
|
||||
i32 pos = view_find_beginning_of_line(view, view->recent->cursor.pos);
|
||||
view_cursor_move(view, pos);
|
||||
}
|
||||
|
||||
COMMAND_DECL(page_down){
|
||||
REQ_READABLE_VIEW(view);
|
||||
|
||||
|
||||
f32 height = view_file_height(view);
|
||||
f32 max_target_y = view->recent->scroll.max_y;
|
||||
|
||||
view->recent->scroll.target_y += height;
|
||||
if (view->recent->scroll.target_y > max_target_y) view->recent->scroll.target_y = max_target_y;
|
||||
|
||||
view->recent->cursor = view_compute_cursor_from_xy(
|
||||
view, 0, view->recent->scroll.target_y + (height - view->font_height)*.5f);
|
||||
|
||||
view->recent->scroll.target_y =
|
||||
clamp_top(view->recent->scroll.target_y + height, max_target_y);
|
||||
|
||||
view->recent->cursor =
|
||||
view_compute_cursor_from_xy(view, 0, view->recent->scroll.target_y + (height - view->font_height)*.5f);
|
||||
}
|
||||
|
||||
COMMAND_DECL(page_up){
|
||||
REQ_READABLE_VIEW(view);
|
||||
|
||||
|
||||
f32 height = view_file_height(view);
|
||||
f32 min_target_y = view->recent->scroll.min_y;
|
||||
|
||||
view->recent->scroll.target_y -= height;
|
||||
if (view->recent->scroll.target_y < min_target_y) view->recent->scroll.target_y = min_target_y;
|
||||
|
||||
view->recent->cursor = view_compute_cursor_from_xy(
|
||||
view, 0, view->recent->scroll.target_y + (height - view->font_height)*.5f);
|
||||
|
||||
view->recent->scroll.target_y =
|
||||
clamp_bottom(0.f, view->recent->scroll.target_y - height);
|
||||
|
||||
view->recent->cursor =
|
||||
view_compute_cursor_from_xy(view, 0, view->recent->scroll.target_y + (height - view->font_height)*.5f);
|
||||
}
|
||||
|
||||
COMMAND_DECL(open_color_tweaker){
|
||||
USE_VIEW(view);
|
||||
USE_MODELS(models);
|
||||
|
||||
|
||||
view_show_theme(view, &models->map_ui);
|
||||
}
|
||||
|
||||
COMMAND_DECL(open_config){
|
||||
USE_VIEW(view);
|
||||
USE_MODELS(models);
|
||||
|
||||
|
||||
view_show_config(view, &models->map_ui);
|
||||
}
|
||||
|
||||
|
|
|
@ -1422,7 +1422,7 @@ view_get_cursor_y(View *view){
|
|||
|
||||
internal void
|
||||
view_move_cursor_to_view(View *view){
|
||||
f32 min_target_y = view->recent->scroll.min_y;
|
||||
f32 min_target_y = 0;
|
||||
i32 line_height = view->font_height;
|
||||
f32 old_cursor_y = view_get_cursor_y(view);
|
||||
f32 cursor_y = old_cursor_y;
|
||||
|
@ -1465,7 +1465,7 @@ view_move_view_to_cursor(View *view, GUI_Scroll_Vars *scroll){
|
|||
f32 target_x = scroll_vars.target_x;
|
||||
|
||||
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(0, line_height);
|
||||
|
||||
if (cursor_y > target_y + cursor_max_y){
|
||||
target_y = cursor_y - cursor_max_y + delta_y;
|
||||
|
@ -1474,8 +1474,7 @@ view_move_view_to_cursor(View *view, GUI_Scroll_Vars *scroll){
|
|||
target_y = cursor_y - delta_y - cursor_min_y;
|
||||
}
|
||||
|
||||
if (target_y > scroll_vars.max_y) target_y = scroll_vars.max_y;
|
||||
if (target_y < scroll_vars.min_y) target_y = view->recent->scroll.min_y;
|
||||
target_y = clamp(0.f, target_y, scroll_vars.max_y);
|
||||
|
||||
if (cursor_x < target_x){
|
||||
target_x = (f32)Max(0, cursor_x - max_x/2);
|
||||
|
@ -1535,7 +1534,11 @@ view_set_file(View *view, Editing_File *file, Models *models){
|
|||
if (file_is_ready(file)){
|
||||
view_measure_wraps(&models->mem.general, view);
|
||||
view->recent->cursor = view_compute_cursor_from_pos(view, view->recent->cursor.pos);
|
||||
|
||||
#if 0
|
||||
view->recent->scroll.max_y = 1000000000.f;
|
||||
#endif
|
||||
|
||||
view_move_view_to_cursor(view, &view->recent->scroll);
|
||||
}
|
||||
}
|
||||
|
@ -1551,11 +1554,13 @@ view_set_file(View *view, Editing_File *file, Models *models){
|
|||
if (file_is_ready(file)){
|
||||
view_measure_wraps(&models->mem.general, view);
|
||||
view->recent->cursor = view_compute_cursor_from_pos(view, file->state.cursor_pos);
|
||||
|
||||
#if 0
|
||||
view->recent->scroll.max_y = 1000000000.f;
|
||||
#endif
|
||||
|
||||
view_move_view_to_cursor(view, &view->recent->scroll);
|
||||
if (!found_recent_entry){
|
||||
view->reinit_scrolling = 1;
|
||||
}
|
||||
view->reinit_scrolling = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1564,7 +1569,6 @@ view_set_file(View *view, Editing_File *file, Models *models){
|
|||
struct Relative_Scrolling{
|
||||
f32 scroll_x, scroll_y;
|
||||
f32 target_x, target_y;
|
||||
f32 scroll_min_limit;
|
||||
};
|
||||
|
||||
internal Relative_Scrolling
|
||||
|
@ -1574,7 +1578,6 @@ view_get_relative_scrolling(View *view){
|
|||
cursor_y = view_get_cursor_y(view);
|
||||
result.scroll_y = cursor_y - view->recent->scroll.scroll_y;
|
||||
result.target_y = cursor_y - view->recent->scroll.target_y;
|
||||
result.scroll_min_limit = view->recent->scroll.min_y;
|
||||
return(result);
|
||||
}
|
||||
|
||||
|
@ -1583,10 +1586,8 @@ view_set_relative_scrolling(View *view, Relative_Scrolling scrolling){
|
|||
f32 cursor_y;
|
||||
cursor_y = view_get_cursor_y(view);
|
||||
view->recent->scroll.scroll_y = cursor_y - scrolling.scroll_y;
|
||||
view->recent->scroll.target_y = cursor_y - scrolling.target_y;
|
||||
if (view->recent->scroll.target_y < scrolling.scroll_min_limit){
|
||||
view->recent->scroll.target_y = scrolling.scroll_min_limit;
|
||||
}
|
||||
view->recent->scroll.target_y =
|
||||
clamp_bottom(0.f, cursor_y - scrolling.target_y);
|
||||
}
|
||||
|
||||
inline void
|
||||
|
@ -2940,7 +2941,7 @@ style_get_color(Style *style, Cpp_Token token){
|
|||
inline f32
|
||||
view_compute_max_target_y(i32 lowest_line, i32 line_height, f32 view_height){
|
||||
f32 max_target_y = ((lowest_line+.5f)*line_height) - view_height*.5f;
|
||||
if (max_target_y < 0) max_target_y = 0;
|
||||
max_target_y = clamp_bottom(0.f, max_target_y);
|
||||
return(max_target_y);
|
||||
}
|
||||
|
||||
|
@ -3402,10 +3403,7 @@ view_reinit_scrolling(View *view){
|
|||
target_x = (f32)(cursor_x - w*.5f);
|
||||
}
|
||||
|
||||
target_y = (f32)FLOOR32(cursor_y - h*.5f);
|
||||
if (target_y < view->recent->scroll.min_y){
|
||||
target_y = view->recent->scroll.min_y;
|
||||
}
|
||||
target_y = clamp_bottom(0.f, (f32)FLOOR32(cursor_y - h*.5f));
|
||||
}
|
||||
|
||||
view->recent->scroll.target_y = target_y;
|
||||
|
@ -3520,7 +3518,7 @@ file_step(View *view, i32_Rect region, Input_Summary *user_input, b32 is_active)
|
|||
f32 rx = (f32)(user_input->mouse.x - region.x0);
|
||||
f32 ry = (f32)(user_input->mouse.y - region.y0);
|
||||
|
||||
if (ry >= -view->recent->scroll.min_y){
|
||||
if (ry >= 0){
|
||||
view_set_widget(view, FWIDG_NONE);
|
||||
if (rx >= 0 && rx < max_x && ry >= 0 && ry < max_visible_y){
|
||||
view_cursor_move(view, rx + scroll_vars.scroll_x, ry + scroll_vars.scroll_y, 1);
|
||||
|
@ -3539,14 +3537,10 @@ do_widget(View *view, GUI_Target *target){
|
|||
Query_Slot *slot;
|
||||
Query_Bar *bar;
|
||||
|
||||
gui_begin_serial_section(target);
|
||||
|
||||
for (slot = view->query_set.used_slot; slot != 0; slot = slot->next){
|
||||
bar = slot->query_bar;
|
||||
gui_do_text_field(target, bar->prompt, bar->string);
|
||||
}
|
||||
|
||||
gui_end_serial_section(target);
|
||||
}
|
||||
|
||||
struct Exhaustive_File_Loop{
|
||||
|
@ -3820,34 +3814,29 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
|
|||
gui_begin_top_level(target, input);
|
||||
{
|
||||
gui_do_top_bar(target);
|
||||
do_widget(view, target);
|
||||
|
||||
if (view->showing_ui == VUI_None){
|
||||
gui_begin_overlap(target);
|
||||
|
||||
gui_begin_serial_section(target);
|
||||
{
|
||||
do_widget(view, target);
|
||||
f32 delta = 9.f * view->font_height;
|
||||
GUI_id scroll_context = {0};
|
||||
scroll_context.id[1] = view->showing_ui;
|
||||
scroll_context.id[0] = (u64)(view->file_data.file);
|
||||
|
||||
gui_begin_serial_section(target);
|
||||
{
|
||||
f32 delta = 9.f * view->font_height;
|
||||
GUI_id scroll_context = {0};
|
||||
scroll_context.id[1] = view->showing_ui;
|
||||
scroll_context.id[0] = (u64)(view->file_data.file);
|
||||
|
||||
view->current_scroll = &view->recent->scroll;
|
||||
gui_get_scroll_vars(target, scroll_context,
|
||||
&view->recent->scroll, &view->scroll_region);
|
||||
|
||||
gui_begin_scrollable(target, scroll_context, view->recent->scroll,
|
||||
delta, show_scrollbar);
|
||||
gui_do_file(target);
|
||||
gui_end_scrollable(target);
|
||||
}
|
||||
gui_end_serial_section(target);
|
||||
view->current_scroll = &view->recent->scroll;
|
||||
gui_get_scroll_vars(target, scroll_context,
|
||||
&view->recent->scroll, &view->scroll_region);
|
||||
|
||||
gui_begin_scrollable(target, scroll_context, view->recent->scroll,
|
||||
delta, show_scrollbar);
|
||||
gui_do_file(target);
|
||||
gui_end_scrollable(target);
|
||||
}
|
||||
gui_end_overlap(target);
|
||||
gui_end_serial_section(target);
|
||||
}
|
||||
else{
|
||||
do_widget(view, target);
|
||||
switch (view->showing_ui){
|
||||
case VUI_Menu:
|
||||
{
|
||||
|
@ -4514,12 +4503,9 @@ do_input_file_view(System_Functions *system,
|
|||
|
||||
case guicom_file:
|
||||
{
|
||||
f32 new_min_y = -(f32)(gui_session_get_eclipsed_y(&gui_session) -
|
||||
gui_session.rect.y0);
|
||||
f32 new_max_y = view_compute_max_target_y(view);
|
||||
|
||||
view->file_region = gui_session.rect;
|
||||
result.vars.min_y = new_min_y;
|
||||
result.vars.max_y = new_max_y;
|
||||
|
||||
if (view->reinit_scrolling){
|
||||
|
@ -4596,10 +4582,8 @@ do_input_file_view(System_Functions *system,
|
|||
if (gui_id_eq(target->mouse_hot, id)){
|
||||
v = unlerp(gui_session.scroll_top, (f32)my,
|
||||
gui_session.scroll_bottom);
|
||||
if (v < 0) v = 0;
|
||||
if (v > 1.f) v = 1.f;
|
||||
result.vars.target_y =
|
||||
lerp(result.vars.min_y, v, result.vars.max_y);
|
||||
v = clamp(0.f, v, 1.f);
|
||||
result.vars.target_y = lerp(0.f, v, result.vars.max_y);
|
||||
|
||||
gui_activate_scrolling(target);
|
||||
result.is_animating = 1;
|
||||
|
@ -4612,12 +4596,8 @@ do_input_file_view(System_Functions *system,
|
|||
if (user_input->mouse.wheel != 0){
|
||||
result.vars.target_y += user_input->mouse.wheel*target->delta;
|
||||
|
||||
if (result.vars.target_y < result.vars.min_y){
|
||||
result.vars.target_y = result.vars.min_y;
|
||||
}
|
||||
if (result.vars.target_y > result.vars.max_y){
|
||||
result.vars.target_y = result.vars.max_y;
|
||||
}
|
||||
result.vars.target_y =
|
||||
clamp(0.f, result.vars.target_y, result.vars.max_y);
|
||||
gui_activate_scrolling(target);
|
||||
result.is_animating = 1;
|
||||
}
|
||||
|
@ -4629,9 +4609,7 @@ do_input_file_view(System_Functions *system,
|
|||
|
||||
if (scroll_button_input(target, &gui_session, user_input, id, &result.is_animating)){
|
||||
result.vars.target_y -= target->delta * 0.25f;
|
||||
if (result.vars.target_y < result.vars.min_y){
|
||||
result.vars.target_y = result.vars.min_y;
|
||||
}
|
||||
result.vars.target_y = clamp_bottom(0.f, result.vars.target_y);
|
||||
}
|
||||
}break;
|
||||
|
||||
|
@ -4641,19 +4619,14 @@ do_input_file_view(System_Functions *system,
|
|||
|
||||
if (scroll_button_input(target, &gui_session, user_input, id, &result.is_animating)){
|
||||
result.vars.target_y += target->delta * 0.25f;
|
||||
if (result.vars.target_y > result.vars.max_y){
|
||||
result.vars.target_y = result.vars.max_y;
|
||||
}
|
||||
result.vars.target_y = clamp_top(0.f, result.vars.max_y);
|
||||
}
|
||||
}break;
|
||||
|
||||
case guicom_end_scrollable_section:
|
||||
{
|
||||
if (!is_file_scroll){
|
||||
f32 new_min_y = gui_session.suggested_min_y;
|
||||
f32 new_max_y = gui_session.suggested_max_y;
|
||||
|
||||
result.vars.min_y = new_min_y;
|
||||
result.vars.max_y = new_max_y;
|
||||
}
|
||||
}break;
|
||||
|
|
67
4ed_gui.cpp
67
4ed_gui.cpp
|
@ -171,8 +171,6 @@ struct GUI_Edit{
|
|||
|
||||
enum GUI_Command_Type{
|
||||
guicom_null,
|
||||
guicom_begin_overlap,
|
||||
guicom_end_overlap,
|
||||
guicom_begin_serial,
|
||||
guicom_end_serial,
|
||||
guicom_top_bar,
|
||||
|
@ -371,16 +369,6 @@ gui_push_string(GUI_Target *target, GUI_Header *h, String s){
|
|||
gui_push_string(target, h, s, 0);
|
||||
}
|
||||
|
||||
internal void
|
||||
gui_begin_overlap(GUI_Target *target){
|
||||
gui_push_simple_command(target, guicom_begin_overlap);
|
||||
}
|
||||
|
||||
internal void
|
||||
gui_end_overlap(GUI_Target *target){
|
||||
gui_push_simple_command(target, guicom_end_overlap);
|
||||
}
|
||||
|
||||
internal void
|
||||
gui_begin_serial_section(GUI_Target *target){
|
||||
gui_push_simple_command(target, guicom_begin_serial);
|
||||
|
@ -661,10 +649,10 @@ gui_get_scroll_vars(GUI_Target *target, GUI_id scroll_context_id, GUI_Scroll_Var
|
|||
*vars_out = target->scroll_updated;
|
||||
*region_out = target->region_updated;
|
||||
|
||||
if (vars_out->target_y < vars_out->min_y) vars_out->target_y = vars_out->min_y;
|
||||
if (vars_out->target_y < 0) vars_out->target_y = 0;
|
||||
if (vars_out->target_y > vars_out->max_y) vars_out->target_y = vars_out->max_y;
|
||||
|
||||
if (vars_out->scroll_y < vars_out->min_y) vars_out->scroll_y = vars_out->min_y;
|
||||
if (vars_out->scroll_y < 0) vars_out->scroll_y = 0;
|
||||
if (vars_out->scroll_y > vars_out->max_y) vars_out->scroll_y = vars_out->max_y;
|
||||
|
||||
if (gui_id_eq(target->active, gui_id_scrollbar())){
|
||||
|
@ -724,7 +712,6 @@ gui_activate_scrolling(GUI_Target *target){
|
|||
}
|
||||
|
||||
struct GUI_Section{
|
||||
b32 overlapped;
|
||||
i32 max_v, v, top_v;
|
||||
};
|
||||
|
||||
|
@ -739,7 +726,6 @@ struct GUI_Session{
|
|||
i32_Rect full_rect;
|
||||
i32_Rect rect;
|
||||
|
||||
f32 suggested_min_y;
|
||||
f32 suggested_max_y;
|
||||
i32 clip_y;
|
||||
|
||||
|
@ -759,17 +745,11 @@ struct GUI_Session{
|
|||
|
||||
#define GUIScrollbarWidth 16
|
||||
|
||||
// TODO(allen): We can probably totally get rid of this now.
|
||||
internal i32
|
||||
gui_session_get_eclipsed_y(GUI_Session *session){
|
||||
GUI_Section *section = session->sections;
|
||||
i32 count = session->t + 1, i;
|
||||
i32 max_v = 0;
|
||||
for (i = 0; i < count; ++i, ++section){
|
||||
if (section->overlapped){
|
||||
max_v = Max(max_v, section->max_v);
|
||||
}
|
||||
}
|
||||
max_v = Max(max_v, session->sections[count-1].top_v);
|
||||
i32 count = session->t + 1;
|
||||
i32 max_v = session->sections[count-1].top_v;
|
||||
return(max_v);
|
||||
}
|
||||
|
||||
|
@ -804,9 +784,7 @@ gui_session_init(GUI_Session *session, GUI_Target *target,
|
|||
|
||||
internal void
|
||||
gui_section_end_item(GUI_Section *section, i32 v){
|
||||
if (!section->overlapped){
|
||||
section->v = v;
|
||||
}
|
||||
section->v = v;
|
||||
if (section->max_v < v){
|
||||
section->max_v = v;
|
||||
}
|
||||
|
@ -978,29 +956,10 @@ gui_interpret(GUI_Target *target, GUI_Session *session, GUI_Header *h,
|
|||
switch (h->type){
|
||||
case guicom_null: Assert(0); break;
|
||||
|
||||
case guicom_begin_overlap:
|
||||
++session->t;
|
||||
Assert(session->t < ArrayCount(session->sections));
|
||||
new_section = &session->sections[session->t];
|
||||
new_section->overlapped = 1;
|
||||
new_section->v = y;
|
||||
new_section->max_v = y;
|
||||
new_section->top_v = y;
|
||||
break;
|
||||
|
||||
case guicom_end_overlap:
|
||||
Assert(session->t > 0);
|
||||
Assert(section->overlapped);
|
||||
prev_section = &session->sections[--session->t];
|
||||
end_v = section->max_v;
|
||||
end_section = prev_section;
|
||||
break;
|
||||
|
||||
case guicom_begin_serial:
|
||||
++session->t;
|
||||
Assert(session->t < ArrayCount(session->sections));
|
||||
new_section = &session->sections[session->t];
|
||||
new_section->overlapped = 0;
|
||||
new_section->v = y;
|
||||
new_section->max_v = y;
|
||||
new_section->top_v = y;
|
||||
|
@ -1008,7 +967,6 @@ gui_interpret(GUI_Target *target, GUI_Session *session, GUI_Header *h,
|
|||
|
||||
case guicom_end_serial:
|
||||
Assert(session->t > 0);
|
||||
Assert(!section->overlapped);
|
||||
prev_section = &session->sections[--session->t];
|
||||
end_v = section->max_v;
|
||||
end_section = prev_section;
|
||||
|
@ -1110,7 +1068,6 @@ gui_interpret(GUI_Target *target, GUI_Session *session, GUI_Header *h,
|
|||
|
||||
case guicom_scrollable:
|
||||
Assert(session->is_scrollable == 0);
|
||||
Assert(!section->overlapped);
|
||||
session->is_scrollable = 1;
|
||||
always_give_to_user = 1;
|
||||
|
||||
|
@ -1128,7 +1085,6 @@ gui_interpret(GUI_Target *target, GUI_Session *session, GUI_Header *h,
|
|||
|
||||
case guicom_scrollable_bar:
|
||||
Assert(session->is_scrollable);
|
||||
Assert(!section->overlapped);
|
||||
give_to_user = 1;
|
||||
rect.x1 = session->full_rect.x1;
|
||||
rect.x0 = rect.x1 - GUIScrollbarWidth;
|
||||
|
@ -1151,7 +1107,6 @@ gui_interpret(GUI_Target *target, GUI_Session *session, GUI_Header *h,
|
|||
|
||||
case guicom_scrollable_top:
|
||||
Assert(session->is_scrollable);
|
||||
Assert(!section->overlapped);
|
||||
give_to_user = 1;
|
||||
gui_scrollbar_top(session->scroll_rect, &rect);
|
||||
scroll_v = 0;
|
||||
|
@ -1159,29 +1114,26 @@ gui_interpret(GUI_Target *target, GUI_Session *session, GUI_Header *h,
|
|||
|
||||
case guicom_scrollable_slider:
|
||||
Assert(session->is_scrollable);
|
||||
Assert(!section->overlapped);
|
||||
give_to_user = 1;
|
||||
|
||||
lerp_space_scroll_v =
|
||||
unlerp((f32)target->scroll_original.min_y,
|
||||
unlerp(0,
|
||||
(f32)target->scroll_original.target_y,
|
||||
(f32)target->scroll_original.max_y);
|
||||
|
||||
gui_scrollbar_slider(session->scroll_rect, &rect, lerp_space_scroll_v,
|
||||
&session->scroll_top, &session->scroll_bottom,
|
||||
target->scroll_original.min_y, target->scroll_original.max_y);
|
||||
0, target->scroll_original.max_y);
|
||||
scroll_v = 0;
|
||||
break;
|
||||
|
||||
case guicom_scrollable_invisible:
|
||||
Assert(session->is_scrollable);
|
||||
Assert(!section->overlapped);
|
||||
always_give_to_user = 1;
|
||||
break;
|
||||
|
||||
case guicom_scrollable_bottom:
|
||||
Assert(session->is_scrollable);
|
||||
Assert(!section->overlapped);
|
||||
give_to_user = 1;
|
||||
gui_scrollbar_bottom(session->scroll_rect, &rect);
|
||||
scroll_v = 0;
|
||||
|
@ -1196,9 +1148,6 @@ gui_interpret(GUI_Target *target, GUI_Session *session, GUI_Header *h,
|
|||
|
||||
case guicom_end_scrollable_section:
|
||||
always_give_to_user = 1;
|
||||
session->suggested_min_y =
|
||||
-(f32)(gui_session_get_eclipsed_y(session) -
|
||||
gui_session_get_current_top(session));
|
||||
session->suggested_max_y =
|
||||
(f32)(session->scrollable_items_bottom -
|
||||
session->full_rect.y1 * .5f);
|
||||
|
|
16
4ed_math.cpp
16
4ed_math.cpp
|
@ -464,9 +464,23 @@ unlerp(f32 a, f32 x, f32 b){
|
|||
return(r);
|
||||
}
|
||||
|
||||
inline f32
|
||||
clamp_bottom(f32 a, f32 n){
|
||||
if (n < a) n = a;
|
||||
return (n);
|
||||
}
|
||||
|
||||
inline f32
|
||||
clamp_top(f32 n, f32 z){
|
||||
if (n > z) n = z;
|
||||
return (n);
|
||||
}
|
||||
|
||||
inline f32
|
||||
clamp(f32 a, f32 n, f32 z){
|
||||
return (n<a)?(a):((n>z)?(z):n);
|
||||
if (n < a) n = a;
|
||||
else if (n > z) n = z;
|
||||
return (n);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue