(#396) Scroll wheel now pans the plot in the depth direction

This commit is contained in:
Pål Hagen 2015-09-02 16:30:37 +02:00
parent fd3df6492b
commit 8d7bbb85a9
3 changed files with 16 additions and 1 deletions

View File

@ -172,6 +172,15 @@ void RimWellLogPlot::zoomDepth(double zoomFactor)
setDepthRange(newMinimum, newMaximum);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::panDepth(double panFactor)
{
double delta = panFactor*(m_maximumVisibleDepth - m_minimumVisibleDepth);
setDepthRange(m_minimumVisibleDepth + delta, m_maximumVisibleDepth + delta);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -48,6 +48,7 @@ public:
RiuWellLogPlot* viewer();
void zoomDepth(double zoomFactor);
void panDepth(double panFactor);
void setDepthRange(double minimumDepth, double maximumDepth);
void updateAvailableDepthRange();

View File

@ -32,7 +32,8 @@
#include <math.h>
#define RIU_SCROLLWHEEL_ZOOMFACTOR 1.05
#define RIU_SCROLLWHEEL_ZOOMFACTOR 1.05
#define RIU_SCROLLWHEEL_PANFACTOR 0.05
//--------------------------------------------------------------------------------------------------
///
@ -132,6 +133,10 @@ void RiuWellLogPlot::wheelEvent(QWheelEvent* event)
m_plotDefinition->zoomDepth(1.0/RIU_SCROLLWHEEL_ZOOMFACTOR);
}
}
else
{
m_plotDefinition->panDepth(event->delta() < 0 ? RIU_SCROLLWHEEL_PANFACTOR : -RIU_SCROLLWHEEL_PANFACTOR);
}
event->accept();
}