use shift-click to jump to page start
This commit is contained in:
parent
d1dc7f23c1
commit
e0e1da6d92
3 changed files with 8 additions and 2 deletions
|
@ -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_RIGHT, KEY_RIGHT);
|
||||||
monitor_key(window, key_state, GLFW_KEY_LEFT_ALT, KEY_ALT);
|
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_TAB, KEY_TAB);
|
||||||
|
monitor_key(window, key_state, GLFW_KEY_LEFT_SHIFT, KEY_SHIFT);
|
||||||
|
|
||||||
// Update mouse
|
// Update mouse
|
||||||
f64 mposx, mposy;
|
f64 mposx, mposy;
|
||||||
|
|
|
@ -395,11 +395,15 @@ void update_and_render(Arena *arena, App_State &app, f32 delta_time_ms)
|
||||||
app.inspected_file.mem, hover_display_grouped);
|
app.inspected_file.mem, hover_display_grouped);
|
||||||
if (!app.rndata.header_is_compressed)
|
if (!app.rndata.header_is_compressed)
|
||||||
ImGui::TextColored(ImColor(0.5f, 0.5f, 0.5f), "(Hint: press Alt for single-field hover information)");
|
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);
|
imgui_render_string_tree(scratch.arena, hover_info.desc->head);
|
||||||
app.viewer.hovered_range = hover_info.rng;
|
app.viewer.hovered_range = hover_info.rng;
|
||||||
|
|
||||||
// Clicking on a page section will update the current page in the legend
|
// Shift-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)) {
|
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;
|
u64 page_id = ((const Page_Info_Node *)hovered_section.info)->page_id;
|
||||||
app.viewer.latest_page = viewer_jump_to_page(app, page_id);
|
app.viewer.latest_page = viewer_jump_to_page(app, page_id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ enum Input_Key {
|
||||||
KEY_Q,
|
KEY_Q,
|
||||||
KEY_ALT,
|
KEY_ALT,
|
||||||
KEY_TAB,
|
KEY_TAB,
|
||||||
|
KEY_SHIFT,
|
||||||
|
|
||||||
KEY_COUNT
|
KEY_COUNT
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue