Fix mysterious Y offset in input coordinates

This commit is contained in:
Cameron Gutman 2022-11-06 21:18:35 -06:00
parent a191915b9d
commit 0eeaec548e
2 changed files with 2 additions and 5 deletions

View File

@ -283,11 +283,8 @@ bool MoonlightInstance::HandleInputEvent(const pp::InputEvent& event) {
sqrt(pow(m_LastTouchUpPoint.x() - touchPoint.x(), 2) +
pow(m_LastTouchUpPoint.y() - touchPoint.y(), 2)) > TOUCH_DEAD_ZONE_RADIUS) {
// Scale the touch coordinates to the video rect
//
// For some reason, the x coordinate is already relative to the plugin rect,
// while the y coordinate is not. No clue why that is the case but oh well...
short x = MIN(MAX(touchPoint.x(), 0), m_PluginRect.width());
short y = MIN(MAX(touchPoint.y() - m_PluginRect.y(), 0), m_PluginRect.height());
short y = MIN(MAX(touchPoint.y(), 0), m_PluginRect.height());
// Update the mouse position prior to sending the button down
LiSendMousePositionEvent(x, y, m_PluginRect.width(), m_PluginRect.height());

View File

@ -741,7 +741,7 @@ function fullscreenNaclModule() {
var module = $("#nacl_module")[0];
module.width = zoom * streamWidth;
module.height = zoom * streamHeight;
module.style.paddingTop = ((screenHeight - module.height) / 2) + "px";
module.style.marginTop = ((screenHeight - module.height) / 2) + "px";
}
function stopGameWithConfirmation() {