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

Cursor not refreshing after disableInteractive() #6766

Closed
pabloNeuronup opened this issue Mar 12, 2024 · 2 comments
Closed

Cursor not refreshing after disableInteractive() #6766

pabloNeuronup opened this issue Mar 12, 2024 · 2 comments

Comments

@pabloNeuronup
Copy link

Version

  • Phaser Version: >3.70
  • Operating system: All
  • Browser: All

Description

After a disableInteractive() on a game object cursor doesn't refresh to original state. Despite removeInteractive() works correctly.

Example Test Code

class Example extends Phaser.Scene {
    constructor() {
        super();
    }

    preload() {

    }

    create() {
        const rect = this.add.rectangle(200, 200, 50, 50, 0xff0000);

        rect.setInteractive({ cursor: 'pointer' });
        rect.on('pointerdown', () => { rect.disableInteractive() });
        //rect.on('pointerdown', () => { rect.removeInteractive() });
    }
}

const config = {
    type: Phaser.AUTO,
    width: 800,
    height: 600,
    backgroundColor: '#2d2d2d',
    parent: 'phaser-example',
    pixelArt: true,
    scene: Example
};

const game = new Phaser.Game(config);
@photonstorm
Copy link
Collaborator

While this could be done, disabling any interactive object that sets the cursor would reset the cursor again, no matter how that disable was triggered. This is actually currently an issue with removeInteractive. The cursor has no idea which object made it change; it only knows that it has changed, so a blanket reset would fix this while also having equally unintended side effects.

@photonstorm
Copy link
Collaborator

Thank you for submitting this feature request. We have implemented this and the feature has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants