Refactoring mousePressed to fix hand over not being detected issue