Fix Quartz cursor going to +infinite if the window size was 0

This commit is contained in:
Filippo Tarpini 2021-01-02 18:34:22 +02:00 committed by Filoppi
parent 5a5c815ff0
commit 8813ba69f5
1 changed files with 2 additions and 2 deletions

View File

@ -188,8 +188,8 @@ void KeyboardAndMouse::UpdateInput()
loc.x -= bounds.origin.x;
loc.y -= bounds.origin.y;
m_cursor.x = (loc.x / bounds.size.width * 2 - 1.0) * window_scale.x;
m_cursor.y = (loc.y / bounds.size.height * 2 - 1.0) * window_scale.y;
m_cursor.x = (loc.x / std::max(bounds.size.width, 1.0) * 2 - 1.0) * window_scale.x;
m_cursor.y = (loc.y / std::max(bounds.size.height, 1.0) * 2 - 1.0) * window_scale.y;
}
std::string KeyboardAndMouse::GetName() const