Refactored canvas mouse handlers