Jump to content

Possible bug: button doesn´t work when moved off-screen to on-screen.


Diego Mellizo
 Share

Recommended Posts

Context: in my game i got the setup you can see in the image. I got an image larger than the window, so i'm able to displace the image with the window's scroll bar, in the lower part of the image I got a button so it's initially hidden.

Problem: When I scroll down to see the button and put the pointer over it, it doesn't work for a few seconds (it doesn't execute input events. No hand cursor), after moving the cursor a little while over the button, it works again. I also checked the variables "visible" and "inputEnabled" in the update() but they are always true, so I suppose Phaser do something else to disable elements which are off-screen, and re-enable them once they are on-screen. Any suggestion would be highly appreciated.

bugBtn.jpg.4d2c61bae11d02cbd8d7013fc141b628.jpg

Link to comment
Share on other sites

Thanks for your response. I tried putting "game.input.activePointer.dirty = true;" inside the update function, but it's still not working. I also tried scrolling the window using the mouse wheel while holding and wiggling the pointer over the image, same result. Additionally, i did the test putting the pointer over the button and maintaining it static (no wiggling), after the second or third click it works, it's like it has a delay (maybe after it enters the screen) before it gets active.

Link to comment
Share on other sites

Other way to handle it - make the button invisible. Not sure if you can still click it but if you can in the code for the button do soemthing like 

if this.alpha == 0

{

   return

}

 

Never tried it but that might work. 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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