libretro / libretro/RetroArch

Web-player Touch-Support

Open
#16,688 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
14.1k
Forks
2.2k
Avg merge
7h 35m
Merged PRs (30d)
51

Description

First and foremost consider this:

  • Only RetroArch bugs should be filed here. Not core bugs or game bugs
  • This is not a forum or a help section, this is strictly developer oriented

Description

I am using the web-player on a self hosted server, to store all my games and start them from every computer in my network, what works great!
Now i wanted to play the games with a iPad, and the touch event's don't work as expected.
In the Menu on the clicked Element is selected, but i cannot activate a point.
Also when i activate a Overlay nothing happen when i try to use my touch screen.

I tried a workaround in java-script:

function touchHandler(event)
{
    let type = "";
    switch(event.type)
    {
        case "touchstart": type = "mousedown"; break;
        case "touchmove":  type = "mousemove"; break;
        case "touchend":   type = "mouseup";   break;
        default:           return;
    }

    const touches = event.changedTouches;
    for (let i = 0; i < touches.length; i++) {
        const eventOptions = {
            screenX: touches[i].screenX,
            screenY: touches[i].screenY,
            clientX: touches[i].clientX,
            clientY: touches[i].clientY,
            button: 0 /*left*/
        }
        webPlayerCanvas.dispatchEvent(new MouseEvent(type, eventOptions));
        event.preventDefault();
    }
}

const webPlayerCanvas = document.getElementById("canvas");
webPlayerCanvas.addEventListener("touchstart", touchHandler, true);
webPlayerCanvas.addEventListener("touchmove", touchHandler, true);
webPlayerCanvas.addEventListener("touchend", touchHandler, true);

This works in the menu and also with overlays, but not with multi-touch. So i hope you can help me to create a better experience with my tablet to.

Expected behavior

When i click on the touchscreen then should it response, also with multi-touch.

Actual behavior

Nothing happen when i click on the touch-screen.

Steps to reproduce the bug
  1. Go to libretro with a iPad
  2. In my case it was also possible to reproduce this behavior with Google Chrome and the device toolbar
  3. Wait short, till everything is loaded and the "Run" Button is enabled.
  4. Click on a Menu-Entry and try to trigger a action.
Version/Commit
  • RetroArch: 1.19.1
Environment information
  • OS: iPad OS (17.5.1) and Safari Browser
  • OS: Mac OS (14.4.1) and Google Chrome (125.0.6422.142) with Development Tools and Device-Toolbar

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the web-player canvas input handling and reproduce the issue at https://web.libretro.com/ using an iPad or Chrome's device toolbar. Compare the reported touch-to-mouse workaround with the existing menu and overlay behavior; done means touchscreen menu actions and overlay controls respond, including multi-touch.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.