I think we can move this check to the top. If there is no listener for longpress, we don't need to do such calculation.