mirror of
https://github.com/photonstorm/phaser
synced 2024-11-22 04:33:31 +00:00
Fix InputManager.onTouchMove
to work on scrolled-down pages
`document.elementFromPoint` expects plain viewport coordinates [1], while we used `page[XY]`, which are viewport coordinates with added scroll offsets [2]. So on pages where no scrolling had yet occurred, `InputManager.onTouchMove` worked as expected. But as soon as one scrolled down/right on the page, the element detection was off by the scroll offset. We switch from `page[XY]` to `client[XY]` which are plain viewport coordinates [3] and thereby make element detection work also on pages that have been scrolled around. [1] https://drafts.csswg.org/cssom-view/#dom-document-elementfrompoint [2] https://w3c.github.io/touch-events/#dom-touch-pagex [3] https://w3c.github.io/touch-events/#dom-touch-clientx
This commit is contained in:
parent
47d393ac29
commit
66901b32d3
1 changed files with 1 additions and 1 deletions
|
@ -614,7 +614,7 @@ var InputManager = new Class({
|
||||||
|
|
||||||
if (pointer.active && pointer.identifier === changedTouch.identifier)
|
if (pointer.active && pointer.identifier === changedTouch.identifier)
|
||||||
{
|
{
|
||||||
var element = document.elementFromPoint(changedTouch.pageX, changedTouch.pageY);
|
var element = document.elementFromPoint(changedTouch.clientX, changedTouch.clientY);
|
||||||
var overCanvas = element === this.canvas;
|
var overCanvas = element === this.canvas;
|
||||||
|
|
||||||
if (!this.isOver && overCanvas)
|
if (!this.isOver && overCanvas)
|
||||||
|
|
Loading…
Reference in a new issue