bryceco / GoMap

OpenStreetMap editor for iPhone/iPad
ISC License
301 stars 40 forks source link

Pre calculate what pasting tags will actually change #727

Open verhovsky opened 3 months ago

verhovsky commented 3 months ago

When I press "Copy Tags" and then "Paste" I have no clue what will happen or what happened. I need to check what tags I copied by looking at the node/line I copied from and then I need to check the tags of the thing I'm pasting on to figure out what will happen when I paste. This can be improved if when I press "paste", before you show me a confirmation dialog, you perform the operation for both merging and replacing and figure out what will actually change and then you have 3 cases

bryceco commented 3 months ago

This is a great suggestion, thanks!

bryceco commented 2 months ago

I did some work on this at https://github.com/bryceco/GoMap/tree/tag-merge-alert if you'd like to take a look and play with it.

verhovsky commented 2 months ago

I think merge and replace do the same thing now and also the logic for which to show seems incorrect or I misunderstand what they do. but in the abstract this looks good.

What i expect is the Replace Tags overwrites and adds new tags, whereas Merge Tags leaves existing tags as-is and only add new tags that don't exist on the object being copied onto. so if you press paste then merge and then try to paste again you should see the replace option (but right now it says no change after one merge paste or one replace paste).

How about a more advanced display of what would change, in a table in the modal? it would start with keys that would be overwritten with the new value written in red (old value not shown, if you're feeling adventurous you could implement tapping on the value would show the old value for 1.5 seconds or so, another idea would be tapping on a value changes what will/wont be pasted so if you tap on one of the values that will be replaced it'll go back to the old value and the buttons change from "Merge tags"+"Replace tags" to just "Paste" similarly if you tap on a value that will be merged it would be struck through and pasting wouldn't paste that value, and you'd need to grey out the Paste button if you tap on all the values and pasting becomes a no-op), followed by any keys that would be newly created (merged) with both keys and values in green, followed by all unchanged tags and their value. The buttons could also be colored to match as well.

"no change" shouldn't be a confirmation dialog, just a text notification that disappears after a second or whatever is fine.

bryceco commented 2 months ago

The current (intended) logic is:

I'm not against having a more sophisticated merge modal, but we're not talking about something that will fit in a UIAlertController anymore 😅.

I'm imagining a table like:

key value paste?
building yes
amenity restaurant
wifi

where toggling the paste button will switch the value between target and pasteboard. If it were a desktop app I'd show both values side by side, but I don't think we have room for that.

tordans commented 2 months ago

TBH I was skeptical if the UI that we have right now would work well but having used it for a while now I find it very nice to use.

Adding an optional preview for the merge operation to this UI would be nice, but the overall UI should stay a simple "this or that" decision IMO. Otherwise something that should save me time would require too much thinking and clicking. I tend to review what I merged after anyways…

Maybe this UI could be something like "after I click merge", the full tag UI opens and I see a undo notice at the top. I can then review but also modify what I merged in the form … and have an escape hatch to change it back to the prev state right there.