Fortunately for little Sofie the lion was shut behind 3mm of safety glass because if he had come out to play he may have hurt her.
When this clip was shown on TV an earnest young lion expert said that the lion was probably trying to swat the little girl as he thought she was food. I think he was wrong.
By patting on the window Sofie was inviting Leo to play (in feline language) and he was just responding to that. Though perhaps a tad too enthusiastically.
Any cat would know that I am right. Playful patting is what we do when we want to play with something or someone. I now realise that’s the reason I always get into trouble with hedgehogs.