Fixed a bug with mouse events

- Leaving the canvas no longer clicks buttons/switches