Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hitArea inside container scrolls even when container has scrollFactor(0) #4466

Closed
pinkkis opened this issue Apr 9, 2019 · 2 comments
Closed

Comments

@pinkkis
Copy link

pinkkis commented Apr 9, 2019

Version

  • Phaser Version: 3.16.2
  • Operating system: Win 10
  • Browser: Chrome (latest)

Description

  • Create a container with scrollFactor(0)
  • add an element inside with setInteractive()
  • scroll camera
    -> element stays in place, but interactive hitarea has scrolled with camera movement

Example Test Code

Here's a quick example:
https://jsbin.com/jizijaqote/edit?js,output

In the example, every time you hover over the element, the camera is scrolled down a bit, so you can eventually see the hit area move above the image

Additional Information

@pinkkis pinkkis changed the title hitArea inside container moves even when container has scrollFactor(0) hitArea inside container scrolls even when container has scrollFactor(0) Apr 9, 2019
@LoolzRules
Copy link
Contributor

LoolzRules commented Apr 12, 2019

I've looked through your example and found out that manually setting sprite.setScrollingFactor(0) solves your problem, so it can be used as a workaround. Also, it was not mentioned in the documentation that setting scrollfactor on container sets it on its children (link) so it may be a result of misunderstanding of docs

@photonstorm
Copy link
Collaborator

The Container.setScrollFactor method now has an optional argument updateChildren which can be used to do this directly.

photonstorm added a commit that referenced this issue Apr 24, 2019
…pdateChildren`. If set, it will change the `scrollFactor` values of all the Container children as well as the Container. Fix #4466 #4475
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants