Jump to content

Pointer released outside clicked button triggers click


tackle
 Share

Recommended Posts

Not sure if anything's changed in later versions, but it turns out that if you click/press down on say a Button, and release outside it, it counts as a trigger on that button.

 

Check this example, for example:

http://examples.phaser.io/_site/view_full.html?d=buttons&f=action+on+click.js&t=action%20on%20click

 

What would be the easiest way to check if it's released inside the button?

My button callback looks like this now:

    onMenuButton:function(sprite, pointer) {        if(Phaser.Rectangle.containsPoint(sprite.getBounds(), pointer.positionUp)) {            //do stuff            PicnicPanic.gameplayPaused = true;            this.pauseMenu.show();            console.log('paused');        }    },

It feels a bit like standard boilerplate so just wanna check if this is intended or if I'm just missing another way of doing it.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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