TAMPA — Ryan McDonagh was done working out, and all the Rangers trainers had left the practice facility in Westchester to catch the team flight to Vancouver. But the captain, who was rehabbing his right-hand/wrist injury, stuck around. He turned on the television and sat there by himself, waiting to hear if he had been traded.

By 2 p.m., an hour before Monday’s deadline, there was nothing. He decided he would take the 15-minute drive to his home in Rye to be with his wife and young daughter, telling The Post on Wednesday that he thought, “If something does happen, I’d rather be around my family to go through that emotion.”

On that drive, his agent, Ben Hankinson, called. He told McDonagh that a deal was done, but he wasn’t sure where just yet. So McDonagh opened the door to his house, and he said, “There was about a 15-minute window where we were waiting to find out and waiting to hear. Then Gorts gave me the call and told me.”

That would be general manager Jeff Gorton, who had shipped McDonagh and forward J.T. Miller to the Lightning in exchange for a 2018 first-round pick, a 2019 conditional second-round pick (that could turn into a first), plus roster player Vladislav Namestnikov and two prospects the Rangers are very high on, 20-year-old defenseman Libor Hajek and two-way center Brett Howden.

It also placed McDonagh and Miller on the team with old pals Dan Girardi, Ryan Callahan and Anton Stralman, and with a club that lost a 2-1 overtime game to the Sabres on Wednesday night, but remained with the best-overall record in the league. For all the winning McDonagh and Miller did in New York, they might have their best chance to win a Cup this season — and that is something that both of them have already thought of.

“It’s hard not to, right?” McDonagh said. “First place in the league right now. They’re adding to their team. You don’t want to think too far ahead or think it’s gong to happen just because what they did. But there are a lot of proven winners in here, too.”

Despite McDonagh having been the Rangers captain since 2014, he was not too surprised by the move. Gorton and team president Glen Sather had sent a letter to the fans on Feb. 8 and then held a press conference to describe in detail their desire for a full rebuild. At 28 years old and with one more year left on a deal that carries a relatively modest $4.7 million salary-cap hit, McDonagh knew he was likely on the way out.

“I guess the drastic measures or whatever, with the letter being released and Gorts being honest with everybody in the media, saying everything is on the table, so you know you have to be part of the discussions,” McDonagh said. “It wasn’t as much of an ambush or a shock as probably J.T. had, not knowing at all and being on an airplane thinking about going to play Vancouver.”

Miller was about halfway through that cross-continent flight preparing to play against the Canucks on Wednesday night when Sather walked up to him at 3:05 p.m. and broke the news.

“I thought he was kidding,” Miller told The Post before he made his Tampa debut with 17:40 of ice time on a line with Adam Erne and Tyler Johnson, registering four hits and going 7-for-10 from the face-off dot. “He was smiling, and he was like, ‘You’ve been traded to Tampa.’ And I was like, ‘Seriously?’ And he was like, ‘Yeah, seriously.’ Then I said, ‘Thanks for all the opportunities.’

“They had given me so much opportunity since I was 18 there,” said the 24-year-old Miller, set to be a restricted free agent after the season. “It was an unbelievable organization, they treat everybody so well. I have nothing but nice things to say about them.”

With Gorton having already traded Rick Nash, Michael Grabner and Nick Holden in the days leading up to the deadline, the rebuild already had begun to become a reality. And more deconstruction could certainly happen this summer in the lead-up to June’s draft.

For all of the success the Rangers had with their core group, they never won a Stanley Cup. And at least McDonagh understands that was a key reason all this has happened.

“It sticks with you. That’s exactly why they’re doing this — because we didn’t win,” McDonagh said. “At the end of the day, all of that so-called success, it’s not the top of the mountain, it’s not the No. 1 prize.”

And now McDonagh and Miller might have their best chance at that prize yet. Just not with the Rangers.