- When drawing an Area, the leading edge is allowed to temporarily be in an invalid position (see #4655)..
.. Finishing a drawing is disabled if doing so would close with the invalid leading edge
(closes#4669)
Now instead of creating MultiLineString targets, we just create a bunch of
LineString targets. This makes the code simpler, and anyway the entity is
still there in `properties` for drawing code to decide what to do with the target.
Incidentally, this change allows iD to support an extrusion operation.
(Because each way segment has its own unique GeoJSON target now)
This makes the code a bit more consistent and lets us avoid some
hacky and probably non-performant things:
- abusing CSS classes in the draw/drag datum functions (classed `.target`)
(is this thing target? just check d.properties)
- regexing the id for `-nope$`
(is this thing a nope target? just check d.properties)
- using context.hasEntity to get a the real entity
(is this thing a real osmEntity? just check d.properties)
- fixes code like the restriction editor which uses fake ids for split ways
Drag start is responsible for switching into drag mode, classing
stuff as `active` and kicking off a bunch of other things.
If the drag move happens immediately after this, and includes the
target from the initial active drag, it can cause weird snapping
from the dragnode to its own parent way. (Happened if the user did
a very fast drag from the node along the parent way just next to it)
The goal here is that the code that draws the targets should know better
what parts of the lines/vertices are targetable, rather than just
relying on CSS to ignore the pointer events on the whole line.
e.g. when drawing a line, it's ok for it to loop back and connect
to itself, just not on a segment or vertex adjacent to the active
node.
Previously it was up to the caller to draw whatever they want into the
footer flash. With this change, uiFlash creates an icon and a text, so
the caller doesn't need to do as much work.
Mouseup was turning into a click on whatever was the last thing clicked.
In this walkthrough, this would sometimes be the "Add Area" mode button,
which would re-enter the add area mode and throw away the user's drawing.
(I have no idea why.)
(closes#3986)
Root cause was the vertex shadow strokes were too big, esp on endpoints.
For normal lines 16px stroke width centers on the line, but for vertices
it extends beyond the vertex radius, stealing clicks.
Also switched some "globals" to module variables in draw.js