esm7 / obsidian-map-view

Interactive map view for Obsidian.md

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Follow note issue and other improvements

Darkbluetest opened this issue · comments

Hi

I have v0.15.9 of Obsidian and updated this plugin to 2.1.1, but I have several issue (or maybe it is just me):

1- When "Follow active note" is selected, the map fails to follow the note, it hides all the notes that are not the selected one, but if the note falls outside of current view, it does not change the view to center around it (I use Openstreetmap).

These ones are likely more improvements than "problems":

2- I see the blue glow around the map marker for a location, only when I search for it (using the magnification icon top right on the map), but not when using "follow active note" or a filter query
3- When "Follow active note" is selected, the other notes disappear, instead of being left visible in the map and just add glow to the selected one (I guess because it is a query/filter).

Thanks!

commented

Regarding 1, what's your setting for "Map follows search results" from the settings pane?
If it is turned on, "follow active note" should move the map and not just filter the markers.

Regarding 2 and 3, this is currently the defined behavior. What queries of all types do (and for that matter "follow active note" is a query that is just updated automatically) is to filter the markers.
I wrote the highlight/glow implementation with the intent to expand it, and in the future allow queries to filter and queries to highlight, even with different color sets (e.g. have a query that filters the markers, on top of that a query that adds a blue glow, on top of that a different query that adds a red glow, etc.)
It's currently just in my wishlist, and would love to know if that's something users want.

"Map follows search results" is activated, I tried to disable and enable it, but no changes. The map does not move.

ok for the other features. Obviously, highlighting is something I personally would use much more than the filtering behaviour.

commented

Do you mind to make a video showing the problem? I'm unable to recreate it no matter what I do, and I might be missing some detail that I didn't think to ask about.

Hi, I have done a short video with the testing vault I use normally, the "Turbine" note is the only that works as you will see at the end of the video. I have tested by disablingall plugins too, but no change.

2022-07-31_14-22-16-728.mp4
commented

To understand the source of the issue, can you try the following:

  1. After you choose a file and the query in Map View updated, clear it, then focus on the new file's pane (e.g. 'Blabla') again. Does the map update back and then changes the zoom & pan properly?
  2. Does it work any differently if you switch files using the quick switcher (Ctrl+O by default I think) instead of the file explorer?

Also, is there possibly some error showing up in the Obsidian Developer Console?

  1. No, doing that, shows only the Blabla location but do not centers neither zoom around it. It simply filters out all locations except the Blabla one.
  2. No, any difference. It is exactly the same.

The console does not give any error when selecting the notes, except for the note "Turbine" (which BTW is the only one that works; the map zooms and centers):
image

Hi, there is some improvement about this? This functionality is still broken (at least for me...) with the last update.

commented

Wow, it completely slipped my mind that this is still open.
I remember working on it and making substantial improvements to make this flow more robust, but it was too long ago, I don't recall how it worked out! It must be in the 2.2 version that I've been cooking for some time...
I really hope to be able to continue next week where I left off and release that version soon, after also verifying that it solves this issue.

I have just tested 2.2.0, there is no changem I mean, it still does nto work, and it behaves just as described in this topic. Just to tell my feedback.

Hi, I wanted just to know if you have tried to fix it in the v2.2.0 but failed (as it seems to me...) or if it may be fixed in the next release.
Thanks!

commented

I was unable to locate the code that was meant to fix this, it was somewhere in July :-/ But I know what I did and will recreate it. Sorry for the holdup, I know how much this is troubling you (and likely others too).

Hi, I wanted just to know if you could work on this, or if you are going to release a new version soon. If it could be fixed, I could advance. Anyway I wanted also to thank you for your work in this plugin.

Just in case it helps, it works if there are 2 or more locations in the selected note, when the note has only one location, it does not follow the note...

I suspect that when a note is selected in the tree, you run the "Fit" function (the same that is ran when user clicks "Fit" button), because the "Fit" button behaves just the same, if the selected note has 2 or more locations, then it centers and zoom around the locations, but if the note has only one location, it does nothing (even if the note is off-screen)

commented

It's in my shortlist of the most important next things to do in Map View, but so far this year I have terribly little "off day-job" development time, and so many things to do in this slot, it just takes me a long time to everything :(

Thanks. I understand the situation...let's hope you can find some more free time soon. I hope the hints I gave above will help you maybe to faster pinpoint the problem.

commented

@Darkbluetest can you please test the attached fix? I believe it completely fixes the issue, which you nailed perfectly with the insight that it happens when a note has just one location!
You basically need to extract this zip to VAULT_FOLDER/.obsidian/plugins/obsidian-map-view, overwriting the 3 older files. (It won't hurt to back up this directory first.)
map-view.zip

Hi, thanks for this. Yes, it works correctly! (it still opens the note always in a fixed/same pane, but I think you fixed that in the yet-to-release 2.3.0, if I am not wrong).

When centering on the selected note it jumps to it -except if it is close to the current location-, I don't know if it could be done (added an option...) to move/scroll to the selected's note position instead. It is just a detail.

Now the follow note finally works correctly and that is super fine!

Thank you!

commented

I may have missed something, because this is the work-in-progress 2.3.0, so the bug you're referring to was supposed to be fixed. Can you elaborate what flow you're seeing that doesn't work like you expect? (a video is always the best if you can!)

Hi
Here a capture in video, with two open panes, each one with a note with location/s. It shows that the note clicked in the map opens always in the first (left most pane), regardless to have the second one selected. Then I shwo what happens if the first pane is closed: the map can't open a note at all when the user clicks on the map icon of some location.

28-12-2022_15-04-22.mp4
commented

Well, this sent me down a rabbit hole far deeper than I imagined.
First, the bad news is that Obsidian's API doesn't have a robust notion of "the last pane selected" (before you clicked the map). The plugin can hook to any selection change and keep a list, but it seems to defy how to Obsidian developers meant things to work.
The good news is that beyond the specific bug you mentioned (closing a pane breaks the logic in Obsidian 1.0+), I used the opportunity to overhaul the entire mechanism of choosing where to open notes, and there are now multiple different options configurable for a click, Ctrl+click and a middle-click, including tab support.
So although that's not what you asked, thank you for the lead :)

I see, well the "multiple different options" for each type of click sounds interesting. I wonder which type of options are you considering and if they could solve the problem.

Althoug it seems to me that a smooth and transparent (no special action from user required) way of operating is the ideal, so if making the plugin keep track of selection change is possible, maybe it should be considered even if it does not seem to be the official way of Obsidian, or at least give an option. But I don't know the possible consequences neither if these news different options you are considering could be a transparent solution...

commented

Just released the fix in 3.0.0, so I'm closing this issue. I'd love to follow-up on your idea for a new pane opening logic, and it would help me not forget it if you open a separate issue for it 🙏