Jump to content

Mouseover cursor pointer if already over sprite


stamas47
 Share

Recommended Posts

I have a sprite with .useHandCursor = true and events.onInputOver.add(this.OnMouseOver, this);

BUT: If the mouse is already over the sprite I have to move it out and back again for the event to trigger. 

Now this is not a problem becouse I can rectangle.contain check the mouse cursors position when my button shows but that is only a graphical change. I need to also change the cursor to pointer. I also got this to work but I have to move the cursor (atleast 1 pixel) for the cursor to change.

Is this a browser/html thing? If not how could I instantly change the cursor?

Link to comment
Share on other sites

Check to see if the mouse is over the sprite and if it is, you can manually force the hand cursor by doing something like this:

this.game.canvas.style.cursor = "pointer";
sprite._setHandCursor = true;

I'm not totally sure on the second line, but you might need to include it so that the sprite knows it's using pointer and needs to turn it off on mouse out.

Link to comment
Share on other sites

Thank you for the response but there is no such command as setHandCursor. (And I am using a Graphic as a button background withing a Group anyways)

And yeah, I am already using the first line which only changes the cursor to pointer if i move the mouse atleast 1 pixel.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...