Open Bug 1772760 Opened 2 years ago Updated 2 years ago

Touch simulation inverse PointerEvent.movementX and .movementY

Categories

(DevTools :: Responsive Design Mode, defect, P3)

defect

Tracking

(Not tracked)

People

(Reporter: matte_1500, Unassigned, NeedInfo)

References

(Blocks 1 open bug)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36

Steps to reproduce:

Open devtools and add the following event listner to a page
window.addEventListner((e) => console.log(e.movementX))

Activate Responsive Design Mode and enable touch simulation

Actual results:

When clicking then moving around the pointer, movementX will produce postive values when moving the pointer left, and negative when moving right. When moving up movementY produces positive values, and negative values when moving down.

Expected results:

PointerEvent.movementX and movementY should produce positive and negative values for the same directions as when not using touch simulation.

The Bugbug bot thinks this bug should belong to the 'DevTools::Responsive Design Mode' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Responsive Design Mode
Product: Firefox → DevTools

Will try to reproduce.

Flags: needinfo?(jdescottes)

Hi,

Thanks for filing, but I can't reproduce the issue so far.

window.addEventListner((e) => console.log(e.movementX))

The code snippet shared above is missing the event name. Which event should I use to test this?
Thanks!

Flags: needinfo?(jdescottes) → needinfo?(matte_1500)

Sorry for the miss! the event is pointermove, also realised i misspelled addEventListner, so it should be window.addEventListner("pointermove", (e) => console.log(e.movementX))

Thanks !

Flags: needinfo?(matte_1500)

I did it again... window.addEventListener("pointermove", (e) => console.log(e.movementX))

Thanks :)

I can confirm the issue, although with a real device I only ever seem to get 0 for movementX/Y for the pointermove. But it still seems incorrect that we return negative values when going up/right and positive values when going down/left.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Version: 1.0 Branch → Trunk

Check if we are badly converting values in devtools/server/actors/emulation/touch-simulator.js

Flags: needinfo?(jdescottes)
Severity: -- → S3
Flags: needinfo?(jdescottes)
Priority: -- → P3

For the record I didn't see anything odd in our implementation. We use sendNativeTouchPoint at
https://searchfox.org/mozilla-central/rev/ec3889f74d6b5695833280f4370ca0e9ba59a3e4/devtools/server/actors/emulation/touch-simulator.js#302:

utils.sendNativeTouchPoint(0, TOUCH_STATES[type], pt.x, pt.y, 1, 90, null);

The fixed orientation at 90 seems odd but changing it doesn't do anything.
I'll need to check the way sendNativeTouchPoint is implemented here.

Flags: needinfo?(jdescottes)
You need to log in before you can comment on or make changes to this bug.