1
0
mirror of synced 2025-01-11 05:42:15 +01:00

impr: Reduce jittering when changing the number of hex columns

This commit is contained in:
WerWolv 2024-12-31 17:04:32 +01:00
parent c9e88586aa
commit d7b2b94cec

View File

@ -504,7 +504,7 @@ namespace hex::ui {
} }
const auto bytesPerCell = m_currDataVisualizer->getBytesPerCell(); const auto bytesPerCell = m_currDataVisualizer->getBytesPerCell();
const u16 columnCount = m_bytesPerRow / bytesPerCell; const auto columnCount = m_bytesPerRow / bytesPerCell;
auto byteColumnCount = 2 + columnCount + getByteColumnSeparatorCount(columnCount) + 2 + 2; auto byteColumnCount = 2 + columnCount + getByteColumnSeparatorCount(columnCount) + 2 + 2;
if (byteColumnCount >= IMGUI_TABLE_MAX_COLUMNS) { if (byteColumnCount >= IMGUI_TABLE_MAX_COLUMNS) {
@ -523,6 +523,8 @@ namespace hex::ui {
m_mode = Mode::Overwrite; m_mode = Mode::Overwrite;
Region hoveredCell = Region::Invalid(); Region hoveredCell = Region::Invalid();
ImGui::PushID(m_bytesPerRow);
ON_SCOPE_EXIT { ImGui::PopID(); };
if (ImGui::BeginChild("Hex View", size, ImGuiChildFlags_None, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse)) { if (ImGui::BeginChild("Hex View", size, ImGuiChildFlags_None, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse)) {
this->drawScrollbar(CharacterSize); this->drawScrollbar(CharacterSize);
@ -532,7 +534,7 @@ namespace hex::ui {
ImGui::TableSetupScrollFreeze(0, 2); ImGui::TableSetupScrollFreeze(0, 2);
// Row address column // Row address column
ImGui::TableSetupColumn("hex.ui.common.address"_lang); ImGui::TableSetupColumn("hex.ui.common.address"_lang, ImGuiTableColumnFlags_WidthFixed, CharacterSize.x * fmt::formatted_size("{:08X}: ", (m_scrollPosition + m_visibleRowCount) * m_bytesPerRow + m_provider->getBaseAddress() + m_provider->getCurrentPageAddress()));
ImGui::TableSetupColumn(""); ImGui::TableSetupColumn("");
// Byte columns // Byte columns