Skip to content

Fix _isGlobal flag in ini method #7785

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

Merged
merged 1 commit into from
May 13, 2025
Merged

Fix _isGlobal flag in ini method #7785

merged 1 commit into from
May 13, 2025

Conversation

VANSH3104
Copy link
Contributor

Resolves #7781

Changes:

  • Moved the _isGlobal assignment earlier in the p5 constructor to ensure it is correctly set
  • Fixed _isGlobal flag in init methods by replacing direct init method calls with callRegisteredHooksFor('init') to ensure proper context is set based on _isGlobal flag.
  • This ensures that registered "init" methods correctly receive the global mode status, which is crucial for addons and libraries that rely on this flag.

Screenshots of the change:

PR Checklist

@quinton-ashley
Copy link
Contributor

Looks good to me! 👍

src/core/main.js Outdated
@@ -709,8 +698,13 @@ class p5 {
// detects capitalization mistakes only ( Setup, SETUP, MouseClicked, etc)
p5._checkForUserDefinedFunctions(this);
}

// Bind events to window (not using container div bc key events don't work)
Copy link
Member

@ksen0 ksen0 May 12, 2025

Choose a reason for hiding this comment

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

Hi @VANSH3104, could you move this the comment a bit below please? So it continues to describe for (const e in this._events) {... Thank you!

@ksen0 ksen0 changed the title Fix _isgloabl flag in ini method Fix _isGlobal flag in ini method May 12, 2025
@ksen0 ksen0 merged commit a990d4f into processing:main May 13, 2025
2 checks passed
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.

_isGlobal is false when it should be true
3 participants