mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Fix opengl errors when resizing comparison view to invalid size
Clamp to min 0.0 width
This commit is contained in:
@@ -65,11 +65,15 @@ bool RiuComparisonViewMover::eventFilter( QObject* watched, QEvent* event )
|
|||||||
QPointF normMousePos = {mousePos.x() / m_viewer->width(), mousePos.y() / m_viewer->height()};
|
QPointF normMousePos = {mousePos.x() / m_viewer->width(), mousePos.y() / m_viewer->height()};
|
||||||
cvf::Rectf orgCompViewWindow = m_viewer->comparisonViewVisibleNormalizedRect();
|
cvf::Rectf orgCompViewWindow = m_viewer->comparisonViewVisibleNormalizedRect();
|
||||||
|
|
||||||
m_viewer->setComparisonViewVisibleNormalizedRect(
|
float minx = normMousePos.x();
|
||||||
cvf::Rectf( normMousePos.x(),
|
minx = minx > 1.0 ? 1.0 : minx;
|
||||||
orgCompViewWindow.min().y(),
|
minx = minx < 0.0 ? 0.0 : minx;
|
||||||
( orgCompViewWindow.min().x() + orgCompViewWindow.width() ) - normMousePos.x(),
|
float miny = orgCompViewWindow.min().y();
|
||||||
orgCompViewWindow.height() ) );
|
float width = ( orgCompViewWindow.min().x() + orgCompViewWindow.width() ) - normMousePos.x();
|
||||||
|
width = width < 0.0f ? 0.0 : width;
|
||||||
|
float height = orgCompViewWindow.height();
|
||||||
|
|
||||||
|
m_viewer->setComparisonViewVisibleNormalizedRect( cvf::Rectf( minx, miny, width, height ) );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user