UI fixes
This commit is contained in:
27
ui/ui.jai
27
ui/ui.jai
@@ -480,6 +480,21 @@ ui_init :: () {
|
||||
|
||||
// # BEGIN # LAYOUT ALGORITHM
|
||||
ui_figure_out_sizes :: () {
|
||||
if ui_state.currently_moving_window {
|
||||
ui_state.currently_moving_window.offset.x += xx engine.input.mouse.delta_x;
|
||||
ui_state.currently_moving_window.offset.y += xx engine.input.mouse.delta_y;
|
||||
ui_state.currently_moving_window.offset.x -= xx min(0, ui_state.currently_moving_window.position.x + ui_state.currently_moving_window.offset.x);
|
||||
ui_state.currently_moving_window.offset.y -= xx min(0, ui_state.currently_moving_window.position.y + ui_state.currently_moving_window.offset.y);
|
||||
|
||||
if !key_pressed(.MOUSE_LEFT) ui_state.currently_moving_window = null;
|
||||
|
||||
}
|
||||
|
||||
for *window: ui_state.windows {
|
||||
if window.last_used_frame_index != ui_state.frame_index continue;
|
||||
window.actual_position = window.position + window.offset;
|
||||
}
|
||||
|
||||
// SET ALL PIXEL AND TEXT SIZES
|
||||
for *box : ui_state.boxes {
|
||||
if box.semantic_size[0].size_kind == {
|
||||
@@ -1206,17 +1221,7 @@ ui_update_input :: () {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ui_state.currently_moving_window.offset.x += xx engine.input.mouse.delta_x;
|
||||
ui_state.currently_moving_window.offset.y += xx engine.input.mouse.delta_y;
|
||||
ui_state.currently_moving_window.offset.x -= xx min(0, ui_state.currently_moving_window.position.x + ui_state.currently_moving_window.offset.x);
|
||||
ui_state.currently_moving_window.offset.y -= xx min(0, ui_state.currently_moving_window.position.y + ui_state.currently_moving_window.offset.y);
|
||||
|
||||
if !key_pressed(.MOUSE_LEFT) ui_state.currently_moving_window = null;
|
||||
}
|
||||
|
||||
for *window: ui_state.windows {
|
||||
if window.last_used_frame_index != ui_state.frame_index continue;
|
||||
window.actual_position = window.position + window.offset;
|
||||
|
||||
}
|
||||
|
||||
for *box: ui_state.boxes {
|
||||
|
||||
Reference in New Issue
Block a user