Fixed incorrect keybind

This commit is contained in:
FlamedDogo99 2024-06-01 21:25:12 -05:00
parent 28ff8a35b0
commit 9462369f0a

View File

@ -10,7 +10,7 @@
// //
// @match https://eaglercraft.com/mc/* // @match https://eaglercraft.com/mc/*
// //
// @version 2.0 // @version 2.1
// @updateURL https://raw.githubusercontent.com/FlamedDogo99/EaglerMobile/main/eaglermobile.user.js // @updateURL https://raw.githubusercontent.com/FlamedDogo99/EaglerMobile/main/eaglermobile.user.js
// //
// @run-at document-start // @run-at document-start
@ -259,7 +259,8 @@ function insertCanvasElements() {
startTouchX = null; startTouchX = null;
}, false); }, false);
strafeRightButton.classList.add("hide");
strafeLeftButton.classList.add("hide");
document.body.appendChild(forwardButton); document.body.appendChild(forwardButton);
@ -396,22 +397,22 @@ function insertCanvasElements() {
screenshotButton.style.cssText = "top: 0vh; margin: auto; left: 16vh; right: 0vh; width: 8vh; height: 8vh;" screenshotButton.style.cssText = "top: 0vh; margin: auto; left: 16vh; right: 0vh; width: 8vh; height: 8vh;"
screenshotButton.addEventListener("touchstart", function(e) { screenshotButton.addEventListener("touchstart", function(e) {
keyEvent("f", "keydown"); keyEvent("f", "keydown");
keyEvent("3", "keydown"); keyEvent("2", "keydown");
}, false); }, false);
screenshotButton.addEventListener("touchend", function(e) { screenshotButton.addEventListener("touchend", function(e) {
keyEvent("f", "keyup"); keyEvent("f", "keyup");
keyEvent("3", "keyup"); keyEvent("2", "keyup");
}, false); }, false);
document.body.appendChild(screenshotButton); document.body.appendChild(screenshotButton);
let coordinatesButton = createTouchButton("coordinatesButton", "inGame"); let coordinatesButton = createTouchButton("coordinatesButton", "inGame");
coordinatesButton.style.cssText = "top: 0vh; margin: auto; left: 32vh; right: 0vh; width: 8vh; height: 8vh;" coordinatesButton.style.cssText = "top: 0vh; margin: auto; left: 32vh; right: 0vh; width: 8vh; height: 8vh;"
coordinatesButton.addEventListener("touchstart", function(e) { coordinatesButton.addEventListener("touchstart", function(e) {
keyEvent("f", "keydown"); keyEvent("f", "keydown");
keyEvent("2", "keydown"); keyEvent("3", "keydown");
}, false); }, false);
coordinatesButton.addEventListener("touchend", function(e) { coordinatesButton.addEventListener("touchend", function(e) {
keyEvent("5", "keyup"); keyEvent("f", "keyup");
keyEvent("2", "keyup"); keyEvent("3", "keyup");
}, false); }, false);
document.body.appendChild(coordinatesButton); document.body.appendChild(coordinatesButton);
} }