How to add interactivity by capturing mouse events