feat: Adjust zoom speed based on distance for consistent feel

Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
2026-02-17 11:48:29 -07:00
parent 6721caca9f
commit 3bb8d65fd4

View File

@@ -44,7 +44,13 @@ void Camera::wheelEvent(QWheelEvent* event, const QVector3D& worldPos)
{
QPoint numDegrees = event->angleDelta() / 8;
if (!numDegrees.isNull()) {
float zoomAmount = numDegrees.y() / 5.0f;
// Make zoom speed proportional to distance, with a minimum speed and a cap.
// The factors are chosen to match the original zoom speed at the default zoom level.
float dist = -m_zoom;
dist = qMin(dist, 200.0f); // Cap distance to avoid crazy fast zoom out.
float zoomFactor = dist * 0.009f + 0.02f;
float zoomAmount = numDegrees.y() * zoomFactor;
float oldZoom = m_zoom;
float newZoom = oldZoom + zoomAmount;