Jump to content

Wrong click position on android since yesterday


Leon
 Share

Recommended Posts

It used to work without problems. Now buttons and sprites will only be clicked/touched if I press ~100 pixels bellow them. I didn't change anything and the problem only exists on android. I think not even on all devices.

I use cordova and the newest phaser version. I tried updating cordova but the problem persisted. I think it might have something to do with how I scale the game, but I have no idea how or why this really happens now. It would be great if someone knows why it happens and how to fix it.

Here is my code for scaling:

var width = window.innerWidth;
var height = window.innerHeight;

var targetW = 150;

var scale = width/targetW;

var targetH = height/scale;
		
game.scale.setGameSize(targetW, targetH);
		
game.scale.scaleMode = Phaser.ScaleManager.USER_SCALE;  
game.scale.setUserScale(scale, scale);
		
game.renderer.renderSession.roundPixels = true;  
Phaser.Canvas.setImageRenderingCrisp(this.game.canvas) ;

And here is how I create buttons:

game.add.button(0,50,'play',function(){this.save();game.state.start('Games');},this);

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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