1
0
mirror of synced 2024-09-24 11:38:26 +02:00

fix: Highlighting in hex editor not being drawn correctly anymore

This commit is contained in:
WerWolv 2023-12-17 23:16:04 +01:00
parent f2a795c51e
commit 71dd349044

View File

@ -263,6 +263,11 @@ namespace hex::plugin::builtin::ui {
}
void HexEditor::drawSelectionFrame(u32 x, u32 y, Region selection, u64 byteAddress, u16 bytesPerCell, const ImVec2 &cellPos, const ImVec2 &cellSize, const ImColor &backgroundColor) const {
auto drawList = ImGui::GetWindowDrawList();
// Draw background color
drawList->AddRectFilled(cellPos, cellPos + cellSize, backgroundColor);
if (!this->isSelectionValid()) return;
if (!Region { byteAddress, 1 }.isWithin(selection))
@ -270,11 +275,6 @@ namespace hex::plugin::builtin::ui {
const color_t SelectionFrameColor = ImGui::GetColorU32(ImGuiCol_Text);
auto drawList = ImGui::GetWindowDrawList();
// Draw background color
drawList->AddRectFilled(cellPos, cellPos + cellSize, backgroundColor);
// Draw vertical line at the left of first byte and the start of the line
if (x == 0 || byteAddress == selection.getStartAddress())
drawList->AddLine(cellPos, cellPos + ImVec2(0, cellSize.y), ImColor(SelectionFrameColor), 1_scaled);