Been busy with other stuff in the meantime, and the code had some flaws at the time of my previous reply which is why I didn’t post it, but here’s a reasonable prototype in this fiddle. Instructions are displayed on loading the fiddle, and are mentioned in my previous reply as well.
Enjoy, have fun, and if you care enough to reward the effort, marking this as a solution would be nice. Other than that, who knows, maybe I’ll use this approach in my project as well, to “reset” my globe to fit the view. Designing an automatic while
that alternates between center and fit until the right values are reached is something I’ll leave to you.