Bootstrap Event Handling Causing Performance Issues in Phaser Game #41557
-
Environment
Problem DescriptionI'm developing a game using Phaser 3 within a Vue.js application that uses Bootstrap 5 for UI components. Using Chrome's performance profiler [screenshot], I can see that:
What I've TriedI've attempted several approaches to prevent Bootstrap from handling events on the game container:
<div id="game-container" ref="gameContainer" data-bs-no-jquery="true"/>
.bootstrap-element {
pointer-events: none;
}
#game-container {
pointer-events: auto;
} Unfortunately, these solutions either:
Questions
Any guidance would be greatly appreciated. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
As you said, you're likely seeing performance issues because Bootstrap's global event listeners (from
I'm not the more knowledgeable in JS in the core team, but I don't think there's a Bootstrap API that allows opting-out elements from event delegation. Bootstrap doesn't "scope" its handlers.
I'd say not directly. You could only monkey-patch or override event handlers.
Not known, but canvas-based libraries like Phaser surely don't expect global UI frameworks like Bootstrap to intercept events. Here are other few things to try:
|
Beta Was this translation helpful? Give feedback.
As you said, you're likely seeing performance issues because Bootstrap's global event listeners (from
bootstrap.min.js
) are processing clicks on your Phaser canvas, even though they don't affect it.I'm not the more knowledgeable in JS in the core team, but I don't think there's a Bootstrap API that allows opting-out elements from event delegation. Bootstrap doesn't "scope" its handlers.
I'd say not directly. You could only monkey-patch or override event handlers.
Not known, but canvas…