Curosr does not change even after scene sleep
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 40.3k
- Forks
- 7.2k
- PR merge metrics
- No merged PRs in 30d
Description
Version
- Phaser Version: 3.80.1
- Operating system: Windows
Description
I am using a scene as an inventory window, so it is above another scene.
I have a image object that acts as a button, with setInteractive({ useHandCursor: true }); attached.
When I try to close the scene with scene.sleep() by clicking the button, the cursor remains as 'pointer'.
I expected the cursor to be 'default' when the scene is not active anymore.
Example Test Code
class Test1 extends Phaser.Scene {
constructor() { super('test1')}
create() {
scene.launch('test2');
}
}
class Test2 extends Phaser.Scene {
constructor() { super('test2')}
create() {
const closeButton = this.add.rectangle(0, 0, 200, 200);
closeButton.setInteractive({ useHandCursor: true });
closeButton.on('pointerdown', () => {
this.scale.canvas.style.cursor = 'default'; // I had to manually change the cursor.
this.scene.sleep();
});
}
}
const game = new Phaser.Game({
type: Phaser.AUTO,
width: 800,
height: 800,
backgroundColor: '#111111',
scale: {
mode: Phaser.Scale.FIT,
autoCenter: Phaser.Scale.CENTER_BOTH
},
scene: [ Test1, Test2 ]
})
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the provided Test1/Test2 example and start by tracing the interactive closeButton, pointerdown handler, and scene.sleep() behavior. Inspect how the active scene manages the canvas cursor after sleeping. Done means the cursor returns to the default state when the inventory scene sleeps, without requiring the manual style change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100