From 0eeaec548eaa76d5b1ca0914fb50ae949a0f9b65 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 6 Nov 2022 21:18:35 -0600 Subject: [PATCH] Fix mysterious Y offset in input coordinates --- input.cpp | 5 +---- static/js/index.js | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/input.cpp b/input.cpp index 7f09625..981f217 100644 --- a/input.cpp +++ b/input.cpp @@ -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()); diff --git a/static/js/index.js b/static/js/index.js index 0fb69b3..ceff494 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -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() {