Wheel event are now passed to the active edit plugin. As a consequence an edit plugin can now change the behaviour of the wheel and when an edit is active you cannot zoom anymore...

This commit is contained in:
Paolo Cignoni cignoni 2012-01-30 11:05:57 +00:00
parent 64f97b3d5b
commit 3c6652dd2f

View File

@ -812,26 +812,33 @@ void GLArea::tabletEvent(QTabletEvent*e)
void GLArea::wheelEvent(QWheelEvent*e)
{
setFocus();
const int WHEEL_STEP = 120;
float notch = e->delta()/ float(WHEEL_STEP);
switch(e->modifiers())
{
case Qt::ShiftModifier + Qt::ControlModifier : clipRatioFar = math::Clamp( clipRatioFar*powf(1.2f, notch),0.01f,5000.0f); break;
case Qt::ControlModifier : clipRatioNear = math::Clamp(clipRatioNear*powf(1.2f, notch),0.01f,50.0f); break;
setFocus();
if( (iEdit && !suspendedEditor) )
{
iEdit->wheelEvent(e,*mm(),this);
}
else
{
const int WHEEL_STEP = 120;
float notch = e->delta()/ float(WHEEL_STEP);
switch(e->modifiers())
{
case Qt::ShiftModifier + Qt::ControlModifier : clipRatioFar = math::Clamp( clipRatioFar*powf(1.2f, notch),0.01f,5000.0f); break;
case Qt::ControlModifier : clipRatioNear = math::Clamp(clipRatioNear*powf(1.2f, notch),0.01f,50.0f); break;
case Qt::AltModifier : glas.pointSize = math::Clamp(glas.pointSize*powf(1.2f, notch),0.01f,150.0f);
foreach(MeshModel * mp, this->md()->meshList)
mp->glw.SetHintParamf(GLW::HNPPointSize,glas.pointSize);
break;
case Qt::ShiftModifier : fov = math::Clamp(fov+1.2f*notch,5.0f,90.0f); break;
default:
break;
case Qt::ShiftModifier : fov = math::Clamp(fov+1.2f*notch,5.0f,90.0f); break;
default:
if(isRaster())
this->opacity = math::Clamp( opacity*powf(1.2f, notch),0.1f,1.0f);
else
trackball.MouseWheel( e->delta()/ float(WHEEL_STEP));
break;
}
update();
break;
}
}
update();
}