Skip to content
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

Continue drawing line or area at any point #9657

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open

Conversation

1ec5
Copy link
Collaborator

@1ec5 1ec5 commented May 26, 2023

The Continue operation now allows you to draw freely starting from any point along the line, not only its endpoints. It works on closed lines and areas, too. This makes the operation useful for more tasks, for example:

  • Refining a river with more detailed meanders
  • Updating a building with a newly constructed wing
  • Continuing to draw an area after you accidentally exit drawing mode by clicking twice

In recognition of the Continue operation’s expanded abilities, it has been renamed to Draw.

draw480.mov

Fixes #2272.

1ec5 added 4 commits May 26, 2023 01:41
The Continue operation can now enter drawing mode at any selected vertex, not just an endpoint. Continuing from a non-endpoint deletes that vertex before entering drawing mode to replace it.
@1ec5 1ec5 added operation An editing operation / edit menu item new-feature A new feature for iD labels May 26, 2023
@1ec5 1ec5 self-assigned this May 26, 2023
// Unless an endpoint is selected, delete the selected node in favor of whatever we're going to draw.
// This avoids a situation where it's possible to draw along all but one of the edges.
if (!affix) {
context.perform(actionDeleteNode(_vertex.id));
Copy link
Collaborator Author

@1ec5 1ec5 May 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you select a vertex other than an endpoint, the operation replaces it with the newly drawn vertices. Otherwise, if we were to persist the selected vertex and only continue drawing along either adjacent edge, then either the first or the last edge of the way would become impossible to continue drawing along.

Ideally, this operation would detach the node from the way and only delete the node if it has no tags and no parents.

// If the position is a node index rather than an affix string, the node index will be dynamic based on an offset from the end.
var offsetFromEndNode;
if (typeof position === 'number') {
offsetFromEndNode = context.entity(wayID).nodes.length - position - 1;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you select a vertex other than an endpoint, you draw forward according to the way’s direction. This is simpler and more intuitive than devising a gesture to decide which direction to draw. However, it can get in the way when continuing to draw an area, since the Reverse operation is disabled for areas.

@tyrasd
Copy link
Member

tyrasd commented May 26, 2023

Hey. Very cool! However… I had been "secretly" working on a very similar feature recently. My version has the additional functionality to allow to "fly" along a line (or area outline) without having to re-select the start-vertex of the segment to be improved (similar to how it was proposed in #760):

way-amend-tool

IMHO that functionality is quite important because in a typical use case (e.g. when improving the bends of a waterway or realigning of a path), one does typically want to work on more than just a single segment of a way.

We talked about this the last monthly community meetup, but I definitely should have announced that I had started working on it in the issue #2272 to avoid duplicate work on it. Sorry for that!

@1ec5
Copy link
Collaborator Author

1ec5 commented May 26, 2023

Oh cool, I had totally forgotten about #760. If I’m interpreting your screen recording correctly, you can enter drawing mode and click on an existing adjacent node to move it during drawing mode, correct? That satisfies the use cases I had in mind and gets closer to the request for a gesture in #2272 (comment). I’m curious about how the user can exit edit mode using the mouse if it has this additional behavior. Presumably the user won’t always want to redraw the entire line to the very end.

I’ll leave this PR open for now to serve as a reference point, but I look forward to your better design!

@k-yle k-yle linked an issue Sep 22, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature A new feature for iD operation An editing operation / edit menu item
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refine Way tool like JOSM Allow to continue drawing of area
2 participants