Skip to content

Fix typo in drag_node.js to pass correct entity ID (#13142) - #13168

Open
Hirdyansh-bh wants to merge 2 commits into
openstreetmap:developfrom
Hirdyansh-bh:fix-drag-node-typo-13142
Open

Hirdyansh-bh wants to merge 2 commits into
openstreetmap:developfrom
Hirdyansh-bh:fix-drag-node-typo-13142

Conversation

@Hirdyansh-bh

Copy link
Copy Markdown

Fixes #13142

The 4th argument for geoChooseEdge is activeID, which is meant to tell the snapping logic to ignore the feature that is currently being dragged (so it doesn't try to snap to its own edges).

Since end is just a function here, end.id was passing as undefined, meaning the dragged node's ID was completely missing the exclusion check. Swapping it to entity.id passes the correct node ID and restores the intended self-snapping prevention.

@Hirdyansh-bh

Copy link
Copy Markdown
Author

Just to be sure that the behavior is right, I verified it manually.

I drew a way, dragged one of its nodes directly over its own segments, and confirmed the self-snapping bug is completely gone showing that the entity.id is passed correctly. The node glides right over the line without getting stuck or snapping to it.

13142.Video.Proof.mp4

@matkoniecz

Copy link
Copy Markdown
Collaborator

what you are showing on video is already blocked in released iD version, maybe by a different rule

can you attach pair of before/after videos showing change?

Peek 2026-11-09 01-39

and for other PRs - if you have only after version, can you verify is before state the same?

@matkoniecz matkoniecz added the waitfor-info Waiting for more info label Nov 9, 2026
@Hirdyansh-bh

Copy link
Copy Markdown
Author

You're right. I checked out develop to record a "before" video and I actually couldn't get it to magnetically snap in the UI either. It looks like the self-intersection rule (the red blocked cursor) or something else is already masking this visually.

purely at the code level, end.id is definitely evaluating to undefined here. So it's still completely skipping the activeID exclusion check inside geoChooseEdge. Changing it to entity.id fixes the intended logic, even if the UI is already blocking the drop.

since this is basically just an basic logic fix now, are willing to merge it just to correct the typo, or would you rather close it?

(Also for the other PRs! I'll go back and verify the "before" states for those and post updates there.)

@matkoniecz

Copy link
Copy Markdown
Collaborator

though maybe we can simplify away that code? Or at least note in comment that this check is effectively repeat of other checks?

really not sure what to do here

@k-yle k-yle left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

since this is basically just an basic logic fix now, are willing to merge it just to correct the typo, or would you rather close it?

we don't want to blindly make changes just because it seems more correct.

making a one line change is easy. the more important part of issue #13142 is to think deeply about the original intention, and the consequences of the change (if any).

@Hirdyansh-bh

Copy link
Copy Markdown
Author

Fair point. Let me check git blame to see why that check was added originally. If it's completely redundant now with the self-intersection checks, I can just clean up that block instead of keeping dead code around, will update here shortly.

This branch was successfully deployed

1 active (outdated) deployment
pr-preview-13168 — 7da9671d Deployed Nov 9, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waitfor-info Waiting for more info

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix typo

3 participants