Added touch scrolling in menus

The fake mouse event script now dispatches a scroll event if the pointerlock element is null
This commit is contained in:
FlamedDogo99 2024-05-26 22:08:49 -06:00 committed by GitHub
parent 19e7b49650
commit 657aa3a1ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,7 +7,7 @@
// @license Apache License 2.0 - http://www.apache.org/licenses/
// @match https://eaglercraft.com/mc/*
// @grant none
// @version 1.1
// @version 1.2
// @updateURL https://raw.githubusercontent.com/FlamedDogo99/EaglerMobile/main/eaglermobile.js
// @run-at document-start
// ==/UserScript==
@ -210,10 +210,7 @@ function insertCanvasElements() {
}
e.movementX = touch.pageX - previousX;
e.movementY = touch.pageY - previousY;
var evt = new MouseEvent("mousemove", {
movementX: e.movementX,
movementY: e.movementY
});
var evt = window.fakelock ? new MouseEvent("mousemove", {movementX: e.movementX, movementY: e.movementY}) : new WheelEvent("wheel", {"wheelDeltaY": e.movementY});
canvas.dispatchEvent(evt);
previousX = touch.pageX;
previousY = touch.pageY;