sys: Properly center hex view around selection when jumping

This commit is contained in:
WerWolv
2022-10-09 14:47:38 +02:00
parent aa42fb5076
commit 3a9c3f939e
2 changed files with 14 additions and 5 deletions

View File

@@ -68,8 +68,11 @@ namespace hex::plugin::builtin {
return data.selectionStart.has_value() && data.selectionEnd.has_value();
}
void jumpToSelection() {
void jumpToSelection(bool center = true) {
this->m_shouldJumpToSelection = true;
if (center)
this->m_centerOnJump = true;
}
void scrollToSelection() {
@@ -118,6 +121,7 @@ namespace hex::plugin::builtin {
ContentRegistry::HexEditor::DataVisualizer *m_currDataVisualizer;
bool m_shouldJumpToSelection = false;
bool m_centerOnJump = false;
bool m_shouldScrollToSelection = false;
bool m_shouldJumpWhenOffScreen = false;
bool m_shouldUpdateScrollPosition = false;