A gunman who tried to kill Donald Trump was able to fly a drone and get aerial footage of the western Pennsylvania fairgrounds shortly before the former president was set to speak there, law-enforcement officials briefed on the matter said, further underscoring the stunning security lapses ahead of Trump’s near assassination.