pencilking2002 Posted June 30, 2014 Share Posted June 30, 2014 Hi. I need to implement some dragging in my game. The code below works fine on Desktop and Mobile but when I turn on chrome dev tools on desktop (for testing on mobile) the drag functionality doesn't work, except for the sprite jumping around. Its convenient to be able to test in chrome dev tools, so if anyone has a clue as to why it doesn't work please let me know. Thanks! // Create paddlepaddle = game.add.sprite(game.world.centerX, game.world.height - 100, 'sprites', 'platform.png');paddle.anchor.setTo(0.5, 0.5); paddle.inputEnabled = true;paddle.input.enableDrag(false);paddle.input.allowVerticalDrag = false; Link to comment Share on other sites More sharing options...
lewster32 Posted June 30, 2014 Share Posted June 30, 2014 Do you have touch emulation enabled when opening dev tools? If so this may be causing it. Link to comment Share on other sites More sharing options...
pencilking2002 Posted June 30, 2014 Author Share Posted June 30, 2014 Isn't the whole point of emulating so you can simulate mobile? Either way, toggling emulation on and off has no effect Link to comment Share on other sites More sharing options...
lewster32 Posted July 1, 2014 Share Posted July 1, 2014 It is, I just wanted to try and rule that out - my mileage tends to vary with Chrome's touch emulation. Link to comment Share on other sites More sharing options...
morosenerd Posted July 1, 2014 Share Posted July 1, 2014 I had this problem too, I think it's actually bugged in Chrome (try several different phone presets, some of them should work). I managed to fix it and I *believe* that this is the change that made it (it was necessary for something related to Chrome dev tools anyway ): In Phaser.Mouse (src/input/Mouse.js):start: function () { if (this.game.device.android && this.game.device.chrome === false && this.game.device.touch) { // Android stock browser fires mouse events even if you preventDefault on the touchStart, so ... return; }//LEAVE THE REST UNCHANGED}The "this.game.device.touch" check is added. Link to comment Share on other sites More sharing options...
Recommended Posts