Jump to content

Wrong pointer position when dragging page


Recommended Posts


i'm trying to build an interface which allows me to swipe to the left or right, in order to display settings and such for my game.

i'm currently using hammer.js for the swiping, and some example code from that library for swiping to adjacent 'pages'.

the problem i'm encountering is that during and after swiping (or dragging with the mouse), the pointer in the game is at the

wrong position (see attachment).


you can see it in action here: http://jsfiddle.net/bdPJ2/embedded/result/


to reproduce the error click into, or touch the game area and swipe or drag the page to one side, keep it there for a second or two,

and let go again (you may have to repeat this once or twice).

for around two seconds the game will interpret the pointer position as being somewhere entirely different than where it should be.

i've already tried a lot of methods on the input and pointer classes (like reset()) to correct the problem, but so far nothing worked.

any ideas?





Link to comment
Share on other sites

  • 2 weeks later...

Sorry for semi-offtopic, but I also wanted to have swiping pages, but inside the Phaser Canvas.


So I've created a "Plugin" for this https://gist.github.com/negue/6a3dfb636fdefecd3474

- each "Page" is just a Group


Example: http://codepen.io/anon/pen/siehF


Note: each Page-Group must have set the width Property, because getBounds would only get the width of all children, but for dragging/swiping it is better that each Group has the same Width as the World-Width


Maybe the Plugin isn't 100% production ready, but I'm happy with suggestion / bug fixes :P



Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...