Commit Graph

116 Commits

Author SHA1 Message Date
Bryan Housel
410197ce00 Vertex navigation for home/end should work with way selected
(closes #4841)

Before, first/last keyboard shortcuts only worked if you had a vertex selected.
Now you can navigate to the first/last vertices even if you have the way selected.
2018-03-01 22:23:55 -05:00
Bryan Housel
9b200cf514 Code cleanups, changes to replaceMovedVertex in moveAction
Trying to eliminate the minimum 10m distance for replacing the original
junction vertex - this is a small threshold.  When _not_ replacing this
vertex, the unzorro code will wreck havok on a traffic circle.
(If there is no suitable vertex to use, it will snap to a point between
the nearest vertices, see #4146)
2018-01-28 23:56:03 -05:00
Bryan Housel
d5bf2d9762 Add geoHasLineIntersections, better for testing multipolygon rings
(closes #4741)
2018-01-24 23:16:51 -05:00
Bryan Housel
300616819d Don't use the same keybind id for modeSave (esc dialog) and uiSave (Ctrl+S)
(closes #4728)
2018-01-24 13:46:01 -05:00
Bryan Housel
8c9a0eb2c1 Fix doubleclick on line to create a point
(closes #4691)
2018-01-17 09:23:09 -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
590487d237 Fix escape keybind when conflicts ui is active
(re: 4351)
2018-01-06 23:16:48 -05:00
Bryan Housel
a22cfe64b8 Avoid loading circular relations by storing ids in _loaded object
(re: #3056)
2018-01-06 00:30:26 -05:00
Bryan Housel
ac86869b4a Add conflict checking progress, guard code for user authentication 2018-01-05 18:11:49 -05:00
Bryan Housel
a63c4a72fe Improvements to save flow
- Attempt fast save first, only perform conflict resolution if necessary (re: #3056)
- Block reentry of save, and dont keep focus on save button (closes #4641)
- Refactor modeSave() for code clarity (avoid shared state in closure variables)
2018-01-05 15:11:44 -05:00
Bryan Housel
8914d1ce36 Variable cleanups and formatting 2018-01-04 16:13:13 -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
7155ef8bc6 Fix double clicking on a way to create a vertex 2017-12-18 16:09:07 -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
57ba6a9862 Add selectedIDs() for modeMove and modeRotate
This allows the label collision boxes for the vertices to update
during these modes. Otherwise the labels.js `isInterestingVertex()`
function doesn't consider them interesting enough to update.
2017-12-18 00:11:08 -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
35a9f77a63 Preserve selected entity when cancelling save mode
(closes #4407)
2017-11-12 12:34:04 -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
a43b1e3c0a WIP: fix download changes on save conflicts screen 2017-09-14 22:25:17 -04:00
Bryan Housel
8c9aae1499 Add download changes link to uiCommitChanges summary
(WIP: still need to check IE11 and fix download on conflict screen)
2017-09-14 17:35:06 -04:00
Bryan Housel
5ffa8f535e Relax the availability rules for rotation and reflection operations
(closes #4237)

New rules:
- Rotation available if at least 2 unique nodes in selectedIDs
- Reflection available if at least 3 unique nodes in selectedIDs
2017-08-17 14:32:32 -04:00
Bryan Housel
c56dc5afc3 In save mode, escape should cancel and return to browse mode
(closes #4230)
2017-08-15 14:32:16 -04:00
Bryan Housel
99a3741b0c Better isolation of services, to avoid hitting network during test runs
1. All services are disabled in testing now to prevent network accesses
2. Only services are enabled when needed to test something
3. Many changes throughout code to allow iD to run with services disabled
   (e.g. check for osm service instead of assuming context.connection() will work)
4. Actually export the services so we can disable and enable them
2017-08-09 22:04:09 -04:00
Bryan Housel
d20e053057 Add missing vertex navigation keys '{' and '}' 2017-06-09 12:46:40 -04:00
Bryan Housel
651ec363f6 Undo/Redo while drawing line/area should keep the user in drawing mode
(closes #3530)
2017-05-03 16:08:23 -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
d7728691d4 Allow user to hit escape to leave select mode in walkthrough 2017-03-31 15:04:54 -04:00
Bryan Housel
85ed3cc2d3 Cleanup line drawing code with selected sort 2017-03-21 12:42:46 -04:00