Fix clamping mouse position to aspect ratio adjusted viewport

Fixes #1512
This commit is contained in:
Cameron Gutman 2023-08-08 21:36:50 -05:00
parent 3fee592669
commit eafb018516

View File

@ -477,8 +477,8 @@ namespace input {
auto offsetX = touch_port.client_offsetX;
auto offsetY = touch_port.client_offsetY;
x = std::clamp(x, offsetX, size.first - offsetX);
y = std::clamp(y, offsetY, size.second - offsetY);
x = std::clamp(x, offsetX, (size.first * scalarX) - offsetX);
y = std::clamp(y, offsetY, (size.second * scalarY) - offsetY);
return { (x - offsetX) * touch_port.scalar_inv, (y - offsetY) * touch_port.scalar_inv };
}