Commit Graph

1066 Commits

Author SHA1 Message Date
Bryan Housel
d6e8ca2a1c Transitioned bouncebacks when user drags node onto a nope 2017-12-22 21:06:44 -05:00
Bryan Housel
117ad7d6b6 Transitionable actionMoveNode 2017-12-22 16:57:27 -05:00
Bryan Housel
64a11f4cbf Restore ability to extend line at beginning or end 2017-12-22 15:08:05 -05:00
Bryan Housel
fc680545ad Don't dispatch drag start and move together
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)
2017-12-22 13:58:27 -05:00
Bryan Housel
be00a526b6 Make sure all targets are redrawn during a mode change
There was an issue where the lines did not redraw their targets right away
when entering drag node, which could make it possible for a quick drag node
to try to connect to its parent line.  With the chooseEdge exclusion it
would not connect to the parent nearby, but in another weird part of the line.
2017-12-22 11:42:21 -05:00
Bryan Housel
7851c49e80 Fix nopefilters by testing the original id for the filter 2017-12-22 00:26:39 -05:00
Bryan Housel
2be62fffe5 All the complicated code in drawWay can be removed
Now that we can target specific segments along a line, we don't need
temporary drawing objects or extra code to check for self intersections
2017-12-22 00:01:23 -05:00
Bryan Housel
5d9b051f84 Fix drag_node for touch targets and line snapping 2017-12-21 20:31:20 -05:00
Bryan Housel
d82d5dc3d0 Add skipID to geoChooseEdge, to ignore dragging node 2017-12-21 17:30:50 -05:00
Bryan Housel
6d7659b3bb Refactor common helper code to svg/helpers.js, add area nopes 2017-12-21 10:36:02 -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
563c496a65 Update selected vertices when drawing in select mode
This is a better solution to catching and drawing new verteices that
got added because a user double clicked on a line.
2017-12-19 09:08:59 -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
eafc2b4300 Adjust touch target radii 2017-12-18 17:00:47 -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
bcd511573f Fix extent in turn restrictions viewer, so vertices will render 2017-12-18 00:34:54 -05:00
Bryan Housel
b5eaa76d1a Optimization: when moving stuff around, don't exit/enter nodes
This avoids thrashing the DOM. The positions of the nodes will still
get updated by the update selection.
2017-12-18 00:13:16 -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
9d42d470ca Touch targets can be keyed on entity.id instead of osmEntity.key
to avoid excessive exit/enter flickering
2017-12-15 21:26:58 -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
f0e2d3fbfe Slightly adjust numbers for iconified vertices for better centering
(maybe not changed after we switched to maki2 which has 11px icons)
2017-12-15 17:50:00 -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
ba5b3eee9c More work on vertex drawing, add debug for touch targets 2017-12-15 00:26:37 -05:00
Bryan Housel
b9e48d1682 WIP: Move layer-hit to layer-points with explict sublayers, update tests
This is more work to further isolate the layers that entities draw to.
It makes it easier to debug what is going on, and can eventually lead to
deferred drawing, if each draw function is in its own place and not dependant
on anything else.

I've started to replace the vertex-hover with an explicit layer for touch
targets.

Also had to change a lot of the svg tests, which are really brittle.
Things would happen like - the surface would be created, it would kick of a
deferred redraw, which would notice that the zoom was 0 and call
editOff, which would remove the osm layers that were just created and
that the tests were trying to draw to. These tests need proper zoom and
projection otherwise nothing works.
2017-12-14 17:38:43 -05:00
Bryan Housel
bfaf17538e Move text to single group with subgroups for halo,label,debug 2017-12-14 12:32:28 -05:00
Bryan Housel
24baa5390e Adjust some variable names to better match what they do
- `nodes` are for osm nodes
- `points` are the projected locations of those node `loc` in screen space
2017-12-13 18:31:37 -05:00
Bryan Housel
d9e3367836 More improvements to label vertex avoidance
(re: #4271, #3636)

- better classification of "interesting" vertices
  (include tagged, selected, or child of selected)
- now we can draw labels on selected lines again (revert #3636)
  because the labels will avoid the vertices
- if debugging is on, draw a collision box for the mouse
2017-12-13 18:05:06 -05:00
Bryan Housel
006ee691bf Avoid placing labels in interesting points/vertices
(closes #4271)
2017-12-13 14:31:17 -05:00
Bryan Housel
450392d2e5 Fix label placement for directional points rendered as vertices 2017-12-13 10:23:25 -05:00
Bryan Housel
5d5546d54d Minor code formatting 2017-12-13 10:02:39 -05:00
Bryan Housel
789f1e5f6f Make sure points/vertices render the right things at different zooms 2017-12-13 08:57:43 -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
b394cb6dfa Variable cleanup, elminiate lodash _filter 2017-12-11 17:46:15 -05:00
Bryan Housel
a5bbc21728 Remove unnecessary zoom parameter 2017-12-11 17:34:01 -05:00
Bryan Housel
4b5260a5ab Add wireframe viewfield marker
(styling marker fill in svg is not currently supported)
2017-12-11 15:48:08 -05:00
Bryan Housel
2edbcc4b82 Match any *:direction key, rather than hardcoding a list 2017-12-11 15:17:17 -05:00
Bryan Housel
ee3083b113 Support rendering camera:direction 2017-12-11 11:46:11 -05:00
Bryan Housel
8e19474293 Render directional points (e.g. benches, cameras, signs) as vertices 2017-12-11 10:48:04 -05:00
Bryan Housel
b42c096fe5 Make sure viewfields actually update on update selection 2017-12-10 14:34:50 -05:00
Bryan Housel
2a8bf6c7bf Don't draw viewfields on hover, rearrange code 2017-12-10 00:43:46 -05:00
Bryan Housel
34c98b94e6 Move directions code from vertices to node.js 2017-12-09 12:53:08 -05:00
Bryan Housel
42043b2ce1 Support more tags, cardinal and numeric directions 2017-12-08 16:23:35 -05:00
Bryan Housel
9c649b74cd After switching from arrows to viewfields, forward/backward is different 2017-12-08 14:54:26 -05:00
Bryan Housel
515094cb56 Only add viewfields for an all-way stop on a highway intersection.
Sometimes people tag all-way stop signs at the junction node,
othertimes people tag all-way stop signs at the stop sign location.

What we're doing here is:
- if `stop=all` tagged at the junction, show viewfield in all directions
- if `stop=all` tagged at the sign location, show viewfield according to `direction=` tag
2017-12-08 14:36:45 -05:00