cvshepherd Posted April 16, 2014 Share Posted April 16, 2014 hi,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 thewrong 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? cheers Link to comment Share on other sites More sharing options...
cvshepherd Posted April 17, 2014 Author Share Posted April 17, 2014 just found the checkOffsetInterval() method on the stage instance. lowering this from its default of 2500ms fixed the issue. Link to comment Share on other sites More sharing options...
negue Posted April 26, 2014 Share Posted April 26, 2014 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 Link to comment Share on other sites More sharing options...
luckylooke Posted May 14, 2014 Share Posted May 14, 2014 I have put your latest plugin version into codepen example and it allows swiping to undefined pages http://codepen.io/anon/pen/tIFdh Link to comment Share on other sites More sharing options...
negue Posted May 14, 2014 Share Posted May 14, 2014 Oh, nice bug xD - fixed! And also have added the ability to scroll vertically. http://codepen.io/anon/pen/DaAcK luckylooke 1 Link to comment Share on other sites More sharing options...
luckylooke Posted May 24, 2014 Share Posted May 24, 2014 Oh, nice bug xD - fixed! And also have added the ability to scroll vertically. http://codepen.io/anon/pen/DaAcK It would be nice if you should make horizontal swipe gestures also on vertical groups. You can see also in your demo, that if you want to swipe horizontaly, you need to point small gap between horizontal and vector group. Link to comment Share on other sites More sharing options...
Recommended Posts