Repository navigation
allow follow ways if there are already two ways sharing the same nodes - #9340
Conversation
| return [indexOfLast ? nodes[nodes.length - 2] : nodes[1]] | ||
| }).filter((id) => id !== secondLastNodeId) | ||
|
|
||
| if (!nextNodeIds.length) return; |
There was a problem hiding this comment.
Is doing nothing a good idea when there are no options?
There was a problem hiding this comment.
Yeah, I think there should be a flash message similar to the one below (operations.follow.error.needs_more_initial_nodes). I can fix that after this PR, though.
Btw, this is for situations where the drawn way is not connected to anything, right? Currently (iD v2.23.2), this results in the needs_more_initial_nodes message, which could be also a bit confusing in that situation. 😉
e77c9d0 to
b89717e
Compare
|
@tyrasd can you take a look at this, I would love to hear what you think? |
tyrasd
left a comment
There was a problem hiding this comment.
Hey. Sorry that I didn't respond earlier. These improvements look awesome!
The only thing I think we should still work on is to add back some inline documentation. As some of the parts of the code are not trivial, it wouldn't hurt to add a short explanation here and there. For example, the line nextNodeIds = nextNodeIds.filter((id,_,nodes) => nodes.lastIndexOf(id) === nodes.indexOf(id)) could be annotated with a short explanation and a link back to this PR. Similarly, the different cases for the generation of nextNodeIds could be described such that other devs can get an idea of what it does more quickly.
| return [indexOfLast ? nodes[nodes.length - 2] : nodes[1]] | ||
| }).filter((id) => id !== secondLastNodeId) | ||
|
|
||
| if (!nextNodeIds.length) return; |
There was a problem hiding this comment.
Yeah, I think there should be a flash message similar to the one below (operations.follow.error.needs_more_initial_nodes). I can fix that after this PR, though.
Btw, this is for situations where the drawn way is not connected to anything, right? Currently (iD v2.23.2), this results in the needs_more_initial_nodes message, which could be also a bit confusing in that situation. 😉
69a6cac to
e84c4e0
Compare
|
@tyrasd can you take a look again? |
|
@tyrasd ? |
…ready-two-ways-sharing-the-same-nodes
…ready-two-ways-sharing-the-same-nodes
|
Really appreciate the progress on this! I've had similar comments on the Follow command in #11895 which have been indirectly addressed. One last strange behavior I'm noticing is when following two overlapping ways (e.g. a nature reserve and coastline), the new Follow command will prefer to deviate from these two ways in favor of following a line with no overlap. Although this behavior is intended in Case 1, it probably isn't what the user would want or expect in such cases.
|

Resolves limitation of #8671 @k-yle
Case 1
Connect to the node that is not alongside an edge.
Given Way segments that connect the current node to more than two nodes.
When Exactly one of the next nodes is only connected using one way segment.
Then Connect the current node to the node that is only connected using one way segment.
Solved by:
Video
Screen.Recording.2022-10-22.at.09.37.40.mov
Case 2
Connect to next note, even if there are multiple ways leading there.
Given Multiple way segments that connect the current note to two nodes.
And One of the next nodes is the previous node.
Then Connect the current node to the node that is not the previous node.
Solved by:
Video
Screen.Recording.2022-10-22.at.09.38.49.mov
Case 3
Connect to next note if you are at the start or end of a way.
Given All ways that contain the current node are start or end of a way.
And Lead to the same next node.
Then Connect to the next node.