Updated panning limiting logic to take scale into account.