Sign in to follow this  
Leon

Wrong click position on android since yesterday

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);

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.