Skip to content

fix setPollAlways() hit-testing inactive pointers#7320

Open
Antriel wants to merge 1 commit into
phaserjs:masterfrom
Antriel:master
Open

fix setPollAlways() hit-testing inactive pointers#7320
Antriel wants to merge 1 commit into
phaserjs:masterfrom
Antriel:master

Conversation

@Antriel

@Antriel Antriel commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

When scene.input.setPollAlways() is enabled, InputPlugin.updatePoll would hit-tests every pointer in input.manager.pointers on every frame, including the spare touch pointer (id === 1) that Phaser allocates but keeps parked at world (0,0) with active === false until the first real touch.

As a result, an interactive Game Object whose hit area covers world (0,0) receives pointerover / pointerout events from that idle phantom pointer with no user input at all (the mouse is never moved, the screen is never touched).

Modified Phaser example that reproduces this:

class Example extends Phaser.Scene {
    preload() {
        this.load.image('eye', 'assets/pics/lance-overdose-loader-eye.png');
    }

    create() {
        this.input.setPollAlways();

        const sprite = this.add.sprite(0, 0, 'eye').setInteractive();
        this.input.on('gameobjectover', (pointer, gameObject) => {
            gameObject.setTint(0xff0000);
        });
        this.input.on('gameobjectout', (pointer, gameObject) => {
            gameObject.clearTint();
        });

        this.tweens.add({
            targets: sprite,
            x: 100,
            yoyo: true,
            repeat: -1,
            duration: 500
        });
    }
}

const config = {
    type: Phaser.WEBGL,
    parent: 'phaser-example',
    scene: Example
};

const game = new Phaser.Game(config);

…pointerover`/`pointerout` from a parked pointer at world (0,0)
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.

1 participant