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

Fix #5828, improve GameObject#disableInteractive() and InputPlugin#disable() #5839

Merged
merged 2 commits into from
Dec 1, 2021

Conversation

natureofcode
Copy link
Contributor

@natureofcode natureofcode commented Sep 17, 2021

This PR

  • Fixes a bug

Describe the changes below:

Changed the GameObject.disableInteractive() method behavior to be more similar to the GameObject.removeInteractive().
Now, when GameObject.disableInteractive() or InputPlugin.disable(gameObject) is called, gameObject is being immediately removed from the sensitive temporary arrays involved in event processing.
Another possible solution is to revise the internal logic of InputPlugin class event processing procedures, changing if (input) { /* FIRE EVENT */ } checks to if (input && input.enabled).

Everyone can test this PR in the updated CodeSandbox

Resolves #5828

this._temp.splice(index, 1);
}

for (var i = 0; i < 10; i++)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe change to for (var i = 0; i < this.manager.pointersTotal; i++) for possible optimization?

@natureofcode natureofcode marked this pull request as draft September 17, 2021 15:49
@natureofcode
Copy link
Contributor Author

natureofcode commented Sep 17, 2021

Sorry, this PR requires further investigation, since dragging stops working after re-enabling InteractiveObject with the pointer pressed above. EDIT: Should work properly now.

@natureofcode natureofcode marked this pull request as ready for review September 17, 2021 18:52
@photonstorm photonstorm merged commit 385800e into phaserjs:master Dec 1, 2021
photonstorm added a commit that referenced this pull request Dec 1, 2021
…urn if input false, as object may still be in arrays anyway #5839
@photonstorm
Copy link
Collaborator

👍

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

Successfully merging this pull request may close these issues.

"pointerout" interaction event triggers after disableInteractive()
2 participants