-
Notifications
You must be signed in to change notification settings - Fork 50
Added support to reposition pins #82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Added an attribute to the FileMarker class to store the inline match length Added a context menu item to the map pin to edit location which stores the pin attribute When the map is clicked and the pin attribute is not null it will rewrite the pin location with the clicked location. So far implemented inline locations. Still need to implement front matter locations.
|
That's a great addition that I think many users will greatly appreciate! |
|
Option 1 is the pin is always draggable. I don't think this should be the default behaviour but there should be an option to enable this behaviour to make it easier to reposition a lot of points. Perhaps in the map context menu. Option 2 is kind of jank but is the best way I can see to do it currently. Right click on the pin which makes it draggable via Ideally when the context menu is clicked it should get picked up and follow the mouse but I can't see a way to initiate this without the user doing it. |
|
I think your point of making it easier to reposition many markers is important. |
|
Yeh I could add it to the menu. I was trying not to clutter it too much. Is there a way to trigger the drag start without the user doing it? |
|
You can probably start it by sending a |
|
I think you are right. I tried firing the mousedown event but it did not do anything. |
|
I have this mostly working. |
Switched from the context menu implementation to using Leaflet's dragging mechanism. Editing is toggled from the check box in the left menu.
|
Clearly I don't know enough to hide that popup. |
|
If you get the big things working (most notably a map control that toggles with an indication when we're in move mode, and the function that reliably edits notes' locations in all cases), I can sure take care of that popup! |
|
I am trying to get yawn-yaml to work so that I can load, edit and write back the yaml front matter. |
There may be bugs in these because I cannot package them correctly to test.
|
@esm7 I think that is mostly there. You can recreate this by making a marker then checking the |
Switched yaml handling to the parseYaml and stringifyYaml functions from the obsidian API. They reformat the yaml so it is not ideal but does functionally work.
|
I have switched to the parseYaml and stringifyYaml functions which work but reformat the yaml, remove comments and replace empty values with null so it isn't an ideal solution but it does at least work. |
frontMatterYaml already ends in a newline so adding another one leads to a blank line
On windows the end of line can be \r\n (the \r is optional) Make yaml match lazily so if the front matter is duplicated it only matches the first one.
|
We can't have Map View change the users' front matter, gotta resolve this before moving on :-/
|
|
The front matter after loading is identical however the formatting is changed. I think js-yaml works the same as the functions in obsidian. |
|
IMHO it is perfectly fine to support moving of markers only if they are formatted in the two simple single-line formats that Map View uses. |
There can be whitespace before the first --- in the yaml
|
The one line format is a subset of the full yaml format. ---
location:
- 51.50852314163118
- -0.07697738707065582
--- |
|
I think it's all a matter of error handling. |
|
I don't particularly like the solution. |
|
Like you wrote, there is some issue there with the dependencies, but when trying to dig deeper I suddenly realized that this attempt to get the YAML parsing perfect seems to me like over-engineering it... |
|
A year later, I'd love to see this merged! :) Would love to drag and drop markers. |
This adds a context menu item to reposition pins.
When the context menu item is clicked the next click on the map will move the pin to that location.
You might want this implemented differently. It does not currently have any user feedback but it functionally works.
I still need to implement support for changing the front matter attribute.
Added an attribute to the FileMarker class to store the inline match length
Added a context menu item to the map pin to edit location which stores the pin attribute
When the map is clicked and the pin attribute is not null it will rewrite the pin location with the clicked location.
Implemented changing inline locations.
Implemented changing front matter locations.
resolves #43