bali33 Posted February 24, 2015 Share Posted February 24, 2015 Hi, I'm trying to retrieve the pointer position in Phaser when the mouse is moving hover the body - it works well when listening "mousemove" but when I listen "touchmove" the value is never updated and remains the same as the first time the callback function is called. Any idea why ? Thank youwindow.onGameBuildingClick = function(ev){ ev.preventDefault(); if (Modernizr.touch) dom('body').on('touchmove',onMove); else dom('body').on('mousemove',onMove);};window.onMove = function(ev){ log(game.input.position.x + " - " + game.input.position.y);}; Link to comment Share on other sites More sharing options...
rich Posted February 24, 2015 Share Posted February 24, 2015 Impossible to tell from that small piece of Modernizr / non-Phaser code. Could be anything. Maybe the preventDefault is killing the event before Phaser even has a chance to listen to it. Maybe it's not even set to listen to it. Not really sure. Link to comment Share on other sites More sharing options...
bali33 Posted February 24, 2015 Author Share Posted February 24, 2015 The preventDefault is only in the click callback function - there is none in the onMove function which is correctly called in both cases, touchmove and mousemove. Link to comment Share on other sites More sharing options...
Recommended Posts