Slow down mouse wheel zoom when the shift key is down.
This commit is contained in:
+8
-1
@@ -2851,5 +2851,12 @@ void lcView::OnMouseMove()
|
||||
|
||||
void lcView::OnMouseWheel(float Direction)
|
||||
{
|
||||
mModel->Zoom(mCamera, (int)(((mMouseModifiers & Qt::ControlModifier) ? 100 : 10) * Direction));
|
||||
float Scale = 10.0f;
|
||||
|
||||
if (mMouseModifiers & Qt::ControlModifier)
|
||||
Scale = 100.0f;
|
||||
else if (mMouseModifiers & Qt::ShiftModifier)
|
||||
Scale = 1.0f;
|
||||
|
||||
mModel->Zoom(mCamera, static_cast<int>(Direction * Scale));
|
||||
}
|
||||
|
||||
@@ -232,13 +232,13 @@ void lcViewWidget::wheelEvent(QWheelEvent* WheelEvent)
|
||||
#endif
|
||||
mView->SetMouseModifiers(WheelEvent->modifiers());
|
||||
|
||||
mWheelAccumulator += WheelEvent->angleDelta().y() / 8;
|
||||
int numSteps = mWheelAccumulator / 15;
|
||||
mWheelAccumulator += WheelEvent->angleDelta().y();
|
||||
int Steps = mWheelAccumulator / 8;
|
||||
|
||||
if (numSteps)
|
||||
if (Steps)
|
||||
{
|
||||
mView->OnMouseWheel(numSteps);
|
||||
mWheelAccumulator -= numSteps * 15;
|
||||
mView->OnMouseWheel(Steps / 15);
|
||||
mWheelAccumulator -= Steps * 8;
|
||||
}
|
||||
|
||||
WheelEvent->accept();
|
||||
|
||||
Reference in New Issue
Block a user