Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Have a game object's pointerup event activate outside of hit area


Yora
 Share

Recommended Posts

Hi, I'm wondering if there is a way for the pointerup callback to be called even if the pointer is released outside of the input area:

var slotDragZone = this.scene.add.zone(102, 0, 480, 100).setInteractive();
slotDragZone.on('pointerup', this.slotDragButtonUp);

Currently, slotDragButtonUp won't be called unless the pointer is released within the input area, and I have a lot of functions that rely on that occurring (migrated from Phaser 2).  I've been digging around the Phaser 3 code to find a way to do it but haven't been able to figure out a viable solution that doesn't involve extensive changes to my code. 

Currently my thought is when 'pointerdown' is called on a game object to save it, then when the pointer is released, force the callback assigned to the object to occur.  This has problems like the callback seems only reachable via an unintended obj._events.pointerup.fn() without setting the callback manually on every object, and when obj._events.pointerup.fn() is called I'd be calling in a different context.

If anyone can think of a better way to handle this I would really appreciate it, thanks. 😉

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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