Fix middle click position calculation in detailed view mode