Fix assert lo < hi in std::clamp

This commit is contained in:
Dušan Poizl 2023-04-19 14:33:29 +02:00
parent 2817d3c7c9
commit 21e90b92dc

@ -253,11 +253,11 @@ void ImageWidget::setMTFParams(float low, float mid, float high)
void ImageWidget::setOffset(float dx, float dy)
{
m_dx = std::clamp(dx, 0.0f, m_imgWidth * m_scale - m_width);
m_dx = std::clamp(dx, 0.0f, std::max(0.0f, m_imgWidth * m_scale - m_width));
if(m_showThumbnails)
m_dy = std::clamp(dy, 0.0f, (float)((m_thumbnailCount / (m_width / THUMB_SIZE_BORDER) + 2) * THUMB_SIZE_BORDER_Y - m_height));
m_dy = std::clamp(dy, 0.0f, std::max(0.0f, (float)((m_thumbnailCount / (m_width / THUMB_SIZE_BORDER) + 2) * THUMB_SIZE_BORDER_Y - m_height)));
else
m_dy = std::clamp(dy, 0.0f, m_imgHeight * m_scale - m_height);
m_dy = std::clamp(dy, 0.0f, std::max(0.0f, m_imgHeight * m_scale - m_height));
updateScrollBars();
update();
}