Open Bug 1840836 Opened 2 years ago Updated 1 year ago

pointerlock sends spazzling inputs when the "this document has control of your cursor" prompt fades

Categories

(Core :: DOM: Core & HTML, defect)

Firefox 114
defect

Tracking

()

UNCONFIRMED

People

(Reporter: hp51gvf01, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/114.0

Steps to reproduce:

<head>
<script>
window.addEventListener('load', (e) => {
    let x0 = 0;
    let y0 = 0;
    let sign = 1;
    let raw = false;
    let x=100;
    let y=100;
    let maindiv = document.getElementById('test');
    maindiv.innerHTML = 'hello world';
    let lockChangeAlert = () => {
      if (document.pointerLockElement === maindiv) {
        document.addEventListener("mousemove", updatePosition, false);
        raw = true;
      }
    }
    let updatePosition = (e) => {
        if ( e.buttons==0 && !raw ) {
            document.removeEventListener("mousemove", updatePosition, false);
            raw = false;
            return;
        }
        //  x = e.clientX;
        //  y = e.clientY;
        x += sign*e.movementX;
        y += sign*e.movementY;
        maindiv.innerHTML = x + ',' + y ;
        document.getElementById('object').style.left = x;
        document.getElementById('object').style.top = y;
    }
    document.addEventListener("pointerlockchange", lockChangeAlert, false);
    maindiv.addEventListener("mousedown", async (e) => {
        if (e.button==2) { 
            x0 = e.clientX;
            y0 = e.clientY;
            sign = -1;
            document.getElementById('anchor').style.left = x0;
            document.getElementById('anchor').style.top = y0;
            document.getElementById('anchor').style.visibility = 'visible';
            await maindiv.requestPointerLock({ unadjustedMovement: true,}); 
        } else if (e.button==0) {
            sign = 1;
            document.addEventListener("mousemove", updatePosition, false);
        }
    });
    maindiv.addEventListener("mouseup", () => {
        raw = false;
        document.exitPointerLock();
        document.removeEventListener("mousemove", updatePosition, false);
        document.getElementById('anchor').style.visibility = 'hidden';
    });
})
</script>
</head>
<div id='test' style='z-index:0;top:0;left:0;bottom:0;right:0;position:absolute;background-color:black;color:white'></div>
<div id='anchor' style='z-index:2;width:20px;height;20px;top:0;left:0;visibility:hidden;position:absolute;background-color:lime;color:lime'>.</div>
<div id='object' style='z-index:1;top:100px;left:100px;width:100%;position: absolute;color:red;'>Accusam et et nonummy ipsum feugiat dolore et eirmod sed. Magna dolores no sed rebum et possim diam diam diam labore ipsum amet id duo. Takimata nonumy consetetur amet magna et feugiat dolore velit consectetuer dolores amet consequat. Eos sanctus augue takimata rebum at lorem dolore takimata stet dolor et. Invidunt esse invidunt dolore et. Diam et adipiscing in nonumy odio magna. Dolore consequat amet et diam nobis duo est sea justo tempor nulla.</div>

Actual results:

When you use right-click drag, it works perfectly except during the flyout animation of the "this document has control of your cursor" prompt where your cursor input gets multiplied by like 100x and sends the coordinate flying.

My Setup:
Firefox 114.0.2 (64-bit)
Windows 10 Pro 22H2 19045.3086
Surface Pro 4
Display Scaling: 200%
Windows Pointer Speed: center notch, EPP disabled

Expected results:

the prompt flyout should not have any effect on the raw mouse delta being sent

Actually not only during the flyout, but also the flyin as well, it sends you flying away at a millions miles per hour if you start your motion before clicking.

The Bugbug bot thinks this bug should belong to the 'Core::DOM: Core & HTML' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → DOM: Core & HTML
Product: Firefox → Core

Edit: besides the aforementioned problem, actually I must add that even during the "normal" state it does NOT work perfectly, instead it intermittently stutters and gets random sudden multiplication of speeds.

Attached file index.html

Added a provided testcase as a test file.

It seems fine for me. Although I don't have the exact same setup as the reporter.

Edgar, do you see anything here?

Flags: needinfo?(echen)

Forgot to mention, mouse used is Logitech G305 at 1000Hz polling rate

my trackpad which updates at 30Hz does not have this issue. Nor does an 125Hz office mouse. All my other gaming mice with 1000Hz polling rate reproduces the problem every time.

On underpowered systems such as my tablet it just straight-up spazzes out at a million miles per hour, whereas on my gaming PC it's not as apparent but still very noticeable, though most people who aren't attuned to their muscle memory would probably miss it.

I tried to reproduce this with Logitech G700s which is also a 1000Hz gaming mouse, but It works smooth on my environment.

Flags: needinfo?(echen)
Severity: -- → S3

(In reply to Edgar Chen [:edgar] from comment #9)

I tried to reproduce this with Logitech G700s which is also a 1000Hz gaming mouse, but It works smooth on my environment.

Perhaps try using something other than a NASA supercomputer? Also make sure you're actually running in 1000Hz mode rather than low-power mode.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: