Moved mouseEvents to function

Signed-off-by: Ollie <ollie@oliver-new.net>