mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 06:28:19 +00:00
Fix smooth zooming overshooting the target zoom level
Ensure that the zoom level with smooth zooming does not exceed the target zoom level. Closes #3747.
This commit is contained in:
parent
3e458f8c10
commit
32ce5be301
|
@ -81,7 +81,13 @@ void CCamera::OnRender()
|
|||
}
|
||||
else
|
||||
{
|
||||
const float OldLevel = m_Zoom;
|
||||
m_Zoom = m_ZoomSmoothing.Evaluate(ZoomProgress(Time));
|
||||
if((OldLevel < m_ZoomSmoothingTarget && m_Zoom > m_ZoomSmoothingTarget) || (OldLevel > m_ZoomSmoothingTarget && m_Zoom < m_ZoomSmoothingTarget))
|
||||
{
|
||||
m_Zoom = m_ZoomSmoothingTarget;
|
||||
m_Zooming = false;
|
||||
}
|
||||
}
|
||||
m_Zoom = clamp(m_Zoom, MinZoomLevel(), MaxZoomLevel());
|
||||
}
|
||||
|
|
|
@ -6138,6 +6138,11 @@ void CEditor::UpdateZoom()
|
|||
else
|
||||
{
|
||||
m_Zoom = m_ZoomSmoothing.Evaluate(ZoomProgress(Time));
|
||||
if((OldLevel < m_ZoomSmoothingTarget && m_Zoom > m_ZoomSmoothingTarget) || (OldLevel > m_ZoomSmoothingTarget && m_Zoom < m_ZoomSmoothingTarget))
|
||||
{
|
||||
m_Zoom = m_ZoomSmoothingTarget;
|
||||
m_Zooming = false;
|
||||
}
|
||||
}
|
||||
m_Zoom = clamp(m_Zoom, MinZoomLevel(), MaxZoomLevel());
|
||||
if(g_Config.m_EdZoomTarget)
|
||||
|
|
Loading…
Reference in a new issue