Commit Graph

60 Commits

Author SHA1 Message Date
Bryan Housel
bb30cbf555 Move lib/d3.keybinding.js -> util/keybinding.js
almost none of the original d3 "plugin" code remains
2018-11-13 13:42:09 -05:00
Bryan Housel
3bc841e95b Adjust layer ordering to draw touch targets above data layers 2018-11-09 21:48:45 -05:00
Quincy Morgan
50d0b98be8 Adds undo messages for connecting points to points, vertices, lines, and areas; and vertices to sibling and adjacent vertices
Closes #1252
2018-11-05 17:50:15 -08:00
Bryan Housel
69ebb97815 Simplify drag_note mode 2018-07-24 17:17:24 -04:00
Bryan Housel
7a0d0352d2 Use connection.disabled to prevent dragging from breaking a relation
(closes #4921)
2018-04-14 23:12:53 -04:00
Bryan Housel
8fb083578f Prevent drag/connect which could damage relations
(closes #4921)
2018-04-12 17:32:16 -04:00
Bryan Housel
d5bf2d9762 Add geoHasLineIntersections, better for testing multipolygon rings
(closes #4741)
2018-01-24 23:16:51 -05:00
Bryan Housel
f0a27bc1ec Simplify way segmentation and fix bug with adjacent segment type
(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)
2018-01-09 10:12:29 -05:00
Bryan Housel
e661281e38 Prevent self intersecting lines without a junction node
(closes #4646)
2018-01-08 19:17:50 -05:00
Bryan Housel
ea9643e08b Allow Alt/option key to disable geometry check and nope cursor
(re: #4646)
2018-01-08 15:47:29 -05:00
Bryan Housel
6881205d43 All touch targets are GeoJSON 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
2018-01-01 22:37:10 -05:00
Bryan Housel
9c27893748 Check for valid multipolygon geometry when dragging nodes
(this can get a bit expensive for large/complex multipolygons)
2017-12-31 02:26:19 -05:00
Bryan Housel
4f02340374 Extract self-intersection code to geoHasSelfIntersections
Test for self-intersecting areas in both drag_node and draw_way
2017-12-28 23:10:52 -05:00
Bryan Housel
96afbbd785 Refactor vector math functions from geo.js to vector.js 2017-12-28 01:08:11 -05:00
Bryan Housel
fa7a6ebb12 Snap to nope line targets too, also remove svgBlocker, not needed
(it's easier to just class the surface, and won't interfere with snapping)
2017-12-27 22:51:36 -05:00
Bryan Housel
ee617779a4 Snap to nope targets too (snapping is useful feedback)
Also remove "acting" cursor, which was overriding the no-action
cursor in some situations.
2017-12-25 23:11:00 -05:00
Bryan Housel
009d7b0d65 Add layer blocker and polygon self-intersection geometry check 2017-12-24 09:21:59 -05:00
Bryan Housel
d6e8ca2a1c Transitioned bouncebacks when user drags node onto a nope 2017-12-22 21:06:44 -05:00
Bryan Housel
5d9b051f84 Fix drag_node for touch targets and line snapping 2017-12-21 20:31:20 -05:00
Bryan Housel
f58349864c Add support for nope targets, line sub-segment targeting 2017-12-20 13:52:16 -05:00
Bryan Housel
7994baae23 WIP: trying singular activeID and smarter target drawing code
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.
2017-12-19 11:23:35 -05:00
Bryan Housel
7a8f50c74e More fixes for drawing/snapping, don't draw touch targets for activeIDs 2017-12-18 22:54:49 -05:00
Bryan Housel
2e2b037e36 Move a bunch of commonly used vector and projection math functions into geo
- geoVecAdd
- geoVecSubtract
- geoVecScale
- geoZoomToScale
- geoScaleToZoom
2017-12-18 15:05:42 -05:00
Bryan Housel
18c97d52c8 Extract viewport nudging code from several places to geoViewportEdge 2017-12-18 09:50:17 -05:00
Bryan Housel
aa68b21d7a Add touch targets for line/area 2017-12-17 22:53:58 -05:00
Bryan Housel
5a4faa84a1 Fixed some of the point/vertex/midpoint snapping issues
Still working on snapping to lines/areas, and making sure drawing lines/areas
will complete
2017-12-16 01:33:12 -05:00
Bryan Housel
5cb5456869 Implement touch targets for midpoints and points 2017-12-15 22:50:55 -05:00
Bryan Housel
ba7437b4cc Fix order of vertex in _assign, always get latest entity
(selected or hovered entities are old, if we're moving vertices around)
2017-12-15 21:21:48 -05:00
Bryan Housel
89d8d37576 Drawing all the correct vertices now where I want them, simplify classes
Some highlights
- `getSiblingAndChildVertices` are expensive, so they're saved and called less frequently
- draw touch targets for all the visible vertices
- remove redundant css classes and `setClass` function
2017-12-15 17:28:20 -05:00
Bryan Housel
899abc7ef5 WIP to render vertices while dragging
(re: #3003 / #4602)

For now, drawHover is commented out.  Still not sure what I will do with it.
This means that things flicker a bit when dragging, also connecting nodes
(and closing lines) does not currently work.

There was lot going on preventing the vertices from rendering while dragging.

1. `modeDragNode` needed a proper `selectedIDs()` function that works like other
modes.. Many other places in iD (including the vertex renderer) call `context.selectedIDs()`..
This means that `modeDragNode` needs a new function `restoreSelectedIDs()` to do what
`selectedIDs()` was previously doing (a place to store selectedIDs so that we
can reselect those entities after the user is done dragging a node in select mode)

2. Just so many things in svg/vertices.js
  - siblingAndChildVertices was missing some things for points that we render
    as vertices (points in wireframe, points with directions)
  - the sibling vertices weren't being included in the `filter` function, so
    would disappear when doing differenced/extent redraws
  - probably some other things
2017-12-12 17:39:36 -05:00
Bryan Housel
c6ab9e593d Flash message if drag not allowed because of a hidden connection
(closes #4493)
2017-12-06 00:11:42 -05:00
Bryan Housel
914ef0236a Convert lodah-es and d3 to named imports for modes 2017-09-24 23:25:49 -04:00
Bryan Housel
49c087d51f Rename delegate->selector, adjust formatting, drop userselect polyfill 2017-04-25 16:51:12 -04:00
Bryan Housel
e6da524f82 Allow all nodes and vertices to be dragged
(revert of #3739)
2017-04-25 16:44:09 -04:00
Bryan Housel
d441cd92c3 Smaller nudge regions in drag_node and move
(closes #3956)
2017-04-20 22:18:33 -04:00
Bryan Housel
e756520bd8 suppressMenu(true) is now the default 2017-02-21 15:47:22 -05:00
Bryan Housel
86118ece4e Fix node drag regression introduced in 919234d
(closes #3829)
2017-02-07 11:40:11 -05:00
Bryan Housel
919234d2df Make sure to select vertex-persistent when looking for siblings
(closes #3824)

When hovering, there is also a companion `vertex-hover` element that might
sometimes get selected, and doesn't have the sibling class that enables drag.
2017-02-06 16:43:54 -05:00
Bryan Housel
bc1193c347 Make sure nodes can be dragged too, not just vertices
(fixes bug introduced in 0440054)
2017-01-29 17:23:34 -05:00
Bryan Housel
f93e57b97d Use #map.node() for drag surface instead of svg #surface
This is because #surface can be transformed during a partial redraw
and d3.mouse() returns transformed point, not the real screen point.
a2cf4f32ec/src/point.js (L4-L9)
2017-01-29 17:11:55 -05:00
Bryan Housel
31dcabc8f8 Actually move the dragged point while nudging 2017-01-29 17:01:36 -05:00
Bryan Housel
6c062fb312 WIP: improve edge to support diagonal nudges, redraws on nudge
(working on #3594 today)
2017-01-28 15:51:23 -05:00
Bryan Housel
0440054cd9 Child and sibling vertices should be eligible for drag_node
(closes #3799, see also #3801)
2017-01-27 13:02:27 -05:00
popov
ad06e341ad do not use tabs 2017-01-27 09:54:08 -05:00
popov
56dbebd0b6 fix array concat 2017-01-27 09:54:01 -05:00
popov
a2f9f51ee6 Allow to drag a node when a parent relation is selected 2017-01-27 09:53:52 -05:00
Bryan Housel
0fb506f461 Make sure new midpoint also gets included in activeIDs 2017-01-16 20:37:34 +05:30
popov
42a6530796 Do not attach dragNode behavior in browse mode 2017-01-10 10:41:58 +10:00
Bryan Housel
07fa5fcc34 Refactor Entity, Node, Relation, Tags, Way from core to osm 2016-10-11 22:41:24 -04:00
Bryan Housel
0d0e54fdff Fix more namespaces that were missed in the first pass 2016-10-04 21:15:30 -04:00