mirror of https://github.com/WerWolv/ImHex
parent
88ccb0e075
commit
c1619820c7
|
|
@ -55,6 +55,9 @@ namespace hex::ui {
|
|||
}
|
||||
|
||||
ScrollPosition& operator=(ImS64 value) {
|
||||
if (value < 0)
|
||||
value = 0;
|
||||
|
||||
this->get() = value;
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -157,7 +160,7 @@ namespace hex::ui {
|
|||
|
||||
m_selectionStart = std::clamp<u64>(start, 0, maxAddress);
|
||||
m_selectionEnd = std::clamp<u64>(end, 0, maxAddress);
|
||||
m_cursorPosition = m_selectionEnd;
|
||||
m_cursorPosition = m_selectionStart;
|
||||
|
||||
if (m_selectionChanged) {
|
||||
auto selection = this->getSelection();
|
||||
|
|
|
|||
|
|
@ -1054,15 +1054,15 @@ namespace hex::ui {
|
|||
|
||||
// Calculate the current top and bottom row numbers of the viewport
|
||||
ImS64 currentTopRow = m_scrollPosition;
|
||||
ImS64 currentBottomRow = m_scrollPosition + m_visibleRowCount - 3;
|
||||
ImS64 currentBottomRow = std::max<ImS64>(m_scrollPosition + m_visibleRowCount - 3, 0);
|
||||
|
||||
// Check if the targetRowNumber is outside the current visible range
|
||||
if (ImS64(targetRowNumber) < currentTopRow) {
|
||||
// If target is above the current view, scroll just enough to bring it into view at the top
|
||||
m_scrollPosition = targetRowNumber - (m_visibleRowCount * m_jumpPivot);
|
||||
m_scrollPosition = targetRowNumber + m_visibleRowCount * m_jumpPivot - 3;
|
||||
} else if (ImS64(targetRowNumber) > currentBottomRow) {
|
||||
// If target is below the current view, scroll just enough to bring it into view at the bottom
|
||||
m_scrollPosition = targetRowNumber - (m_visibleRowCount - 3);
|
||||
m_scrollPosition = targetRowNumber - 3;
|
||||
}
|
||||
|
||||
m_jumpPivot = 0.0F;
|
||||
|
|
|
|||
Loading…
Reference in New Issue