Diego Mellizo Posted April 19, 2017 Share Posted April 19, 2017 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. Link to comment Share on other sites More sharing options...
samme Posted April 19, 2017 Share Posted April 19, 2017 Phaser doesn't update inputOver and inputOut events when the pointer/cursor isn't moving. That's why wiggling the cursor fixes it. You could maybe set `activePointer.dirty = true` during or after the scroll. Diego Mellizo 1 Link to comment Share on other sites More sharing options...
Diego Mellizo Posted April 19, 2017 Author Share Posted April 19, 2017 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 More sharing options...
samme Posted April 20, 2017 Share Posted April 20, 2017 For me the pointer is updated once scrolling stops completely (without having to wiggle it): Link to comment Share on other sites More sharing options...
MikeW Posted April 20, 2017 Share Posted April 20, 2017 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 More sharing options...
Recommended Posts