Update touch inputs

This commit is contained in:
2023-10-20 16:19:21 +02:00
parent c950e6ae86
commit 5aded782e7
2 changed files with 10 additions and 29 deletions

View File

@@ -54,17 +54,9 @@ namespace OpenVulkano::Input
}
m_initialDistance = distance;
if (m_initialDistance > 0)
{
m_pinchInfo.scale = m_initialDistance;
m_pinchInfo.position = CalculateCenter();
}
else
{
m_pinchInfo.scale = 0.0f;
m_pinchInfo.position = m_pendingTouches.front().currentPosition;
}
m_pinchInfo.scale = 0;
m_pinchInfo.position = CalculateCenter();
OnPinchStarted.NotifyAll(this, m_pinchInfo);
@@ -202,21 +194,10 @@ namespace OpenVulkano::Input
{
float newDistance = CalculateDistance();
if (m_lastDistance == 0)
{
m_lastDistance = newDistance;
}
if (m_lastDistance == 0) m_lastDistance = newDistance;
if (m_initialDistance > 0)
{
m_pinchInfo.scale = (newDistance - m_initialDistance);
m_pinchInfo.position = CalculateCenter();
}
else
{
m_pinchInfo.scale = 0.0f;
m_pinchInfo.position = m_pendingTouches.front().currentPosition;
}
m_pinchInfo.scale = (newDistance - m_initialDistance);
m_pinchInfo.position = CalculateCenter();
OnPinchMoved.NotifyAll(this, m_pinchInfo);