phaser icon indicating copy to clipboard operation
phaser copied to clipboard

useHandCursor not working for planes

Open Baegus opened this issue 2 years ago • 1 comments

Version

  • Phaser Version: 3.60.0
  • Operating system: Windows 10

Description

It seems that "plane" gameObjects do not support the useHandCursor setting when calling setInteractive(). The interactivity works, but the cursor stays the same. The object still supports pointerover and pointerout events, so it can be implemented manually.

Example Test Code

const plane = this.add.plane(100,100,"myTexture");
plane.setInteractive({useHandCursor: true}); // this works, but doesn't set the cursor on pointerover

// My hacky implementation of useHandCursor follows:
plane.on("pointerover",() => {
	this.game.canvas.style.cursor = "pointer";
});
plane.on("pointerout",() => {
	this.game.canvas.style.cursor = "default";
});

Baegus avatar May 24 '23 08:05 Baegus

This is because the setInteractive method for meshes (which include planes) is different then other gameObjects and does not use a interactive config.

As you can see here: https://github.com/phaserjs/phaser/blob/v3.60.0/src/gameobjects/mesh/Mesh.js#L1166

rgk avatar Jan 14 '24 04:01 rgk

Now Mesh based Game Objects like Plane support an input configuration object, but the properties hitArea, hitAreaCallback, pixelPerfect and alphaTolerance are ignored.

Thank you for submitting this issue. We have fixed this and the fix 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.

rgk avatar Feb 07 '24 04:02 rgk