excaliburjs / Excalibur

🎮 Your friendly TypeScript 2D game engine for the web 🗡️
https://excaliburjs.com
BSD 2-Clause "Simplified" License
1.82k stars 190 forks source link

Support mouseOut/pointerOut style event when the cursor leaves the game canvas #3080

Open eonarheim opened 5 months ago

eonarheim commented 5 months ago

Context

It is often useful in games to know when the pointer leaves the game canvas. For example: pausing, deselecting, performing specific game logic.

Proposal

Create a new excalibur pointer event that tracks, perhaps analogous to the actor "exitviewport" and "enterviewport"

Current strategy

engine.canvas.onmouseout = () =>{
    console.log('Strike!')
};
github-actions[bot] commented 3 months ago

This issue hasn't had any recent activity lately and is being marked as stale automatically.