esm7 / obsidian-map-view

Interactive map view for Obsidian.md

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is there a way to have “AutoZoom” (or “Fit”) enabled for embedded codeblocks?

ces3001 opened this issue · comments

The use case is probably the same as most people’s, if not all, use case for the embedded codeblock, which is to display the current note’s locations.

I am generating a note of my locations automatically from a tracking app. Most of the time a Zoomlevel of 13-15 works fine if I’m not travelling. If I’m travelling or flying there is no way to know the proper zoom level apriori without a lot of guess-work and programming on my end. Wondering if there is an easy “Auto” or “Fit” setting for the “mapZoom” key, as this is already a feature in the plug-in for the right-pane map.

If not, maybe you can give me the algorithm to determine zoom from the range in lat and lon?

commented

Sounds super useful and I'd like to add this soon. However, I'm also seeing some potential for confusion and trouble here, as the "fit" setting will somehow need to work intuitively when users move and zoom the embedded map, then click 'Save'. How would you define such a case to behave -- should "fit" turn off when a user makes manual changes to the map?

commented

This proved to be considerably more complicated than I expected. I added the basic feature in 4.0.0, so you can set autoFit in the code block, but there is not yet a UI for it and the user experience isn't perfect. See here: https://github.com/esm7/obsidian-map-view#advanced-additional-options