diff --git a/src/ui/windows/image_picker.h b/src/ui/windows/image_picker.h index 29f916e..104ca81 100644 --- a/src/ui/windows/image_picker.h +++ b/src/ui/windows/image_picker.h @@ -194,6 +194,12 @@ public: if (col != 0) ImGui::SameLine(0, cellGap); ImVec2 mn = ImGui::GetCursorScreenPos(); ImVec2 mx(mn.x + cellW, mn.y + cellH); + // Off-screen cell: reserve the same space (scroll extent unchanged) but skip hit-test/draw. + if (!ImGui::IsRectVisible(mn, mx)) { + ImGui::Dummy(ImVec2(cellW, cellH)); + col = (col + 1) % cols; + continue; + } ImGui::PushID((int)(i + 1)); const bool clicked = ImGui::InvisibleButton("##idir", ImVec2(cellW, cellH)); const bool hov = ImGui::IsItemHovered(); @@ -224,6 +230,12 @@ public: if (col != 0) ImGui::SameLine(0, gap); ImVec2 mn = ImGui::GetCursorScreenPos(); ImVec2 mx(mn.x + cell, mn.y + cell); + // Off-screen cell: reserve the same space (scroll extent unchanged) but skip hit-test/draw. + if (!ImGui::IsRectVisible(mn, mx)) { + ImGui::Dummy(ImVec2(cell, cell)); + col = (col + 1) % cols; + continue; + } const std::string abs = (std::filesystem::path(s_dir) / s_images[i]).string(); const bool sel = (s_selected == abs); ImGui::PushID((int)(i + 1));