Jump to content

Get mouse position outside game world.


scheffgames
 Share

Recommended Posts

Hi! So I want to get mouse position even when it's outside canvas/game-world. The x,y properties stop updating when the mouse it's outside game world. Also tried worldX/worldY, clientX/clientY, screenX/screenY - to no succes. The only solution seems to write my own mousehandler (with document.onmousemove) but I wanted to know if I can do it in Phaser directly. 

I've used game.input.activePointer to check for above properties.

Thanks!

Link to comment
Share on other sites

I'd imagine this isn't really in Phaser scope, it should only know about the main element (can you pass it an element? I'd imagine it sets up with its own canvas element if you don't/can't supply one) and inputs should really be scoped to that element rather than polluting document.

So I reckon you'd probably have to do this yourself unless you could pass `input` an element it should attach certain events to.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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