use shift-click to jump to page start

This commit is contained in:
silverweed 2024-09-24 11:33:47 +02:00
parent d1dc7f23c1
commit e0e1da6d92
3 changed files with 8 additions and 2 deletions

View file

@ -135,6 +135,7 @@ void run_main_loop(GLFWwindow *window, Arena *arena, App_State &app)
monitor_key(window, key_state, GLFW_KEY_RIGHT, KEY_RIGHT);
monitor_key(window, key_state, GLFW_KEY_LEFT_ALT, KEY_ALT);
monitor_key(window, key_state, GLFW_KEY_TAB, KEY_TAB);
monitor_key(window, key_state, GLFW_KEY_LEFT_SHIFT, KEY_SHIFT);
// Update mouse
f64 mposx, mposy;

View file

@ -395,11 +395,15 @@ void update_and_render(Arena *arena, App_State &app, f32 delta_time_ms)
app.inspected_file.mem, hover_display_grouped);
if (!app.rndata.header_is_compressed)
ImGui::TextColored(ImColor(0.5f, 0.5f, 0.5f), "(Hint: press Alt for single-field hover information)");
if (hovered_section.id == Sec_Page)
ImGui::TextColored(ImColor(0.5f, 0.5f, 0.5f), "(Hint: Shift-Click to jump to the start of this page)");
imgui_render_string_tree(scratch.arena, hover_info.desc->head);
app.viewer.hovered_range = hover_info.rng;
// Clicking on a page section will update the current page in the legend
if (hovered_section.id == Sec_Page && (app.user_input.mouse_btn_state[MOUSE_BTN_LEFT] & MOUSE_BTN_STATE_JUST_PRESSED)) {
// Shift-clicking on a page section will update the current page in the legend
if (hovered_section.id == Sec_Page && (app.user_input.key_state[KEY_SHIFT] & KEY_STATE_IS_DOWN) &&
(app.user_input.mouse_btn_state[MOUSE_BTN_LEFT] & MOUSE_BTN_STATE_JUST_PRESSED))
{
u64 page_id = ((const Page_Info_Node *)hovered_section.info)->page_id;
app.viewer.latest_page = viewer_jump_to_page(app, page_id);
}

View file

@ -6,6 +6,7 @@ enum Input_Key {
KEY_Q,
KEY_ALT,
KEY_TAB,
KEY_SHIFT,
KEY_COUNT
};