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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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