Commit Graph

101 Commits

Author SHA1 Message Date
Bryan Housel
61c7f64077 Remember changeset source, make it settable via url param
(closes #4899)
2018-03-16 09:20:32 -04:00
J Guthrie
d35494d003 Can finish drawing when cursor is in invalid position
- 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
2018-03-08 02:53:03 +00:00
Bryan Housel
24eba5c1b0 Preventing snapping at viewport edge also prevented finishing ways 2018-01-20 22:45:03 -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
58eaca2aa0 Ignore area closing segment during move when validating geometry
(closes #4655)
2018-01-08 12:09:17 -05:00
Bryan Housel
ddaa828ec9 Handle both target GeoJSON and osmEntity in hover
(fixes test and allows hover on the area fills again)
2018-01-01 22:53:40 -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
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
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
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
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
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
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
ba5b3eee9c More work on vertex drawing, add debug for touch targets 2017-12-15 00:26:37 -05:00
Bryan Housel
f247bd1e66 Move icon code into uiFlash, default flash icon to icon-no
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.
2017-12-05 23:41:34 -05:00
Nikita Mashukov
edc30ad41c no prevent the copy event when there is selected text 2017-10-20 20:20:42 +07:00
Bryan Housel
75d2c45fd6 Convert lodah-es and d3 to named imports for behaviors 2017-09-24 21:43:54 -04:00
Bryan Housel
a42aa789e9 Add hashtags API parameter and localStorage
(closes #2834)
2017-08-16 10:47:17 -04:00
Bryan Housel
163323d3df Make sure bool url params actually contain value 'true'
(closes #4222)
2017-08-08 09:51:57 -04:00
Bryan Housel
6ca649498f Add walkthrough=true url parameter to auto-start the walkthrough
(closes #4111)
2017-06-22 22:26:38 -04:00
Bryan Housel
e9568e8845 Don't exit drawing mode on hashchange unless the user has moved a lot
(Switching background while drawing a line was causing the line to get
cancelled because of returning to browse mode)
(closes #4099)
2017-06-12 02:04:22 -04:00
Bryan Housel
b87be2d241 Don't omit tags when copy/pasting
(closes #4067)
2017-05-30 22:29:29 -04:00
Bryan Housel
ff14dbf944 Allow contextmenu events to work on the sidebar
(closes #4036)
2017-05-12 14:39:41 +01:00
Bryan Housel
0c810aebe4 Fix menu key as right click replacement on Windows
(closes #4017)
2017-05-08 22:03:05 +01:00
Bryan Housel
4ee5d7334b Fix spacebar drawing and hover in Firefox - don't match active node
(closes #4016)
2017-05-08 01:37:38 -04:00
Bryan Housel
cd09f9dfee Prevent mouseup from turning into a click
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.)
2017-05-07 22:44:42 -04:00
Bryan Housel
a18d690dd5 Don't let window.location changes happen during draw modes
(closes #3996)
2017-05-03 17:15:35 -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
af31cf5eb5 Fix spacedraw drawing, make clicking less touchy
(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
2017-04-26 16:37:15 -04:00
Bryan Housel
5ca4246a6d If drawing a way, don't hover on a node that was just placed
(closes #3974)
2017-04-26 13:33:21 -04:00
Bryan Housel
49c087d51f Rename delegate->selector, adjust formatting, drop userselect polyfill 2017-04-25 16:51:12 -04:00
Bryan Housel
149cbbe350 Fix hover tests 2017-04-24 10:05:02 -04:00
Bryan Housel
6de6056c66 Don't hover sidebar or vertices when alt key disables snapping
This makes it a little more clear that the alt key is doing its job
2017-04-23 11:11:16 -04:00
Bryan Housel
06caeb87b7 Correct lodash _.omit usage
(closes #3965)
2017-04-22 23:05:15 -04:00
Bryan Housel
a5554cf3b0 Expire saved changeset comment older than 2 days
(closes #3947)
2017-04-21 23:01:32 -04:00
Bryan Housel
8989aea023 Clicking a midpoint should be treated as a click on the parent way 2017-04-14 00:38:04 -04:00
Bryan Housel
7da34f474b Pacify eslint 2017-03-29 12:50:29 -04:00
Bryan Housel
7873f0c425 Relax rules for using keyboard shortcuts in the walkthrough 2017-03-29 12:35:33 -04:00
Bryan Housel
d949fe08cb Fix faulty datum test from 681ee5a 2017-03-22 16:01:14 -04:00
Bryan Housel
681ee5a89a Prevent crash when missing datum
(This can happen if the user mouseups on a tooltip, e.g. in walkthrough)
2017-03-22 10:27:15 -04:00