Touch simulation inverse PointerEvent.movementX and .movementY
Categories
(DevTools :: Responsive Design Mode, defect, P3)
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.
Comment 1•2 years ago
|
||
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.
Comment 3•2 years ago
|
||
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!
Reporter | ||
Comment 4•2 years ago
|
||
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 !
Reporter | ||
Comment 5•2 years ago
|
||
I did it again... window.addEventListener("pointermove", (e) => console.log(e.movementX))
Comment 6•2 years ago
|
||
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.
Comment 7•2 years ago
|
||
Check if we are badly converting values in devtools/server/actors/emulation/touch-simulator.js
Updated•2 years ago
|
Comment 8•2 years ago
|
||
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.
Description
•