Commit Graph

66 Commits

Author SHA1 Message Date
Quincy Morgan
d01bb78707 Reduce circular dependencies caused by importing from indexes, the location of the validation models, and the location of areaKeys (close #6237) 2019-04-24 13:45:59 -07:00
Bryan Housel
a3bc164c43 Redraw entity editor fields on addition, deletion too
This is important to make the turn restriction editor work
2019-04-23 01:07:38 -04:00
Bryan Housel
3673a7c7e7 Remove lodash cloneDeep
(re #6087)

- some were able to do a different approach
    (validations/almost_junction, and settings/*)
- some were replaced with custom speedy cloners
   (in orthogonalize clonePoints and osm.js cloneNoteCache)
- some just replaced with JSON.parse(JSON.stringify()))
2019-03-29 17:18:40 -04:00
Bryan Housel
8b0e729b9c Merge pull request #5502 from jguthrie100/redraw_restrictions_on_sidebar_drag
Redraw restrictions panel when dragging sidebar
2018-11-30 01:30:03 -05:00
Bryan Housel
958d7fac4f wip changing all fields to use flexbox everywhere 2018-11-28 18:15:38 -05:00
Bryan Housel
4533603a88 preset-input-wrap -> form-field-input-wrap
This better describes what it does.
Also, took this opportunity to update a bunch of the uifield code
(no multi line variable declarations, prefix state variables with _,
eliminate unnecessray lodash, etc)
2018-11-27 10:54:03 -05:00
J Guthrie
82bc803bb0 Lower redraw threshold to 1px 2018-11-26 01:43:51 +00:00
J Guthrie
7bf4c462e8 Lowered redraw threshold to 2px 2018-11-21 09:25:30 +00:00
J Guthrie
c002ab8b1d Only redraw restrictions panel every 10px sidebar is dragged 2018-11-21 09:05:33 +00:00
J Guthrie
5fc312620f Converted to using custom Event 2018-11-20 18:39:00 +00:00
J Guthrie
6137941efd Redraw restrictions panel when dragging sidebar 2018-11-19 15:23:30 +00:00
Bryan Housel
4a3d5e2316 Avoid reflow caused by restriction editor checking its dimensions 2018-11-10 00:40:45 -05:00
Bryan Housel
3bc841e95b Adjust layer ordering to draw touch targets above data layers 2018-11-09 21:48:45 -05:00
Bryan Housel
08d9a0267b Guard code to avoid deleting a turn twice
(see #4968, #4928)
2018-04-12 13:18:49 -04:00
Martin Raifer
d2d464d9ee only drop restrictions from FROM towards VIA when adding new only
partially adresses bugs in #4968:

* doesn't crash anymore in complex situations (short FROM ways where both ends connect to a TO way)
* adding a only-restriction at one end of a short FROM doesn't delete restrictions on the other end of the same FROM anymore
2018-04-10 13:19:20 +02:00
Bryan Housel
a160c00c35 Hide Turn Restriction field on trivial junctions
(closes #4934)
2018-03-27 23:54:26 -04:00
Bryan Housel
78170f8fe9 Improve hint text to aid in localization
- change the "Up to {num} ways" to "Up to 2 ways"
  (we don't plan to go above 2 for now)
- enumerate all the turn types No/Only/Allowed x Left/Right/Straight/U
- Add a line for "Click for" to let user know they can click to toggle

see https://github.com/openstreetmap/iD/pull/4768#pullrequestreview-100256196
2018-03-01 00:58:53 -05:00
Bryan Housel
241159b547 Cleanup docs and tests for actionRestrictTurn / actionUnrestrictTurn
- actionRestrictTurn will no longer "infer" the turn type
- restrictionType *must* be passed in - this is ok because the only code
  we use this action (restrictions.js) already has inferred the type
- this simplifies what the action actually does
- moved the tests from restrict_turn.js that were really just testing
  the restriction type inferrence over to intersection.js
  (and added a few more tests for iD.osmInferRestriction)
2018-02-28 23:55:59 -05:00
Bryan Housel
f9d000a8a5 When switching to ONLY restriction remove all other restrictions
But we keep them around in `_oldTurns` and will put them back if the
user clicks again to unrestrict the ONLY.
2018-02-27 22:53:46 -05:00
Bryan Housel
c63f79a753 Remove isComplex, not used
This was used to decide whether to show the "Max Via" control.
(It's not really needed for a simple intersection)

However since we added the "Max Distance" control, it just makes
sense to show both sliders, since the distance can affect the
complexity.
2018-02-22 22:36:04 -05:00
Bryan Housel
aaed678468 Localize all the strings 2018-02-22 22:26:45 -05:00
Bryan Housel
156d0fd681 Drop confusing fromOnly code, consolidate path highlighting code 2018-02-21 00:33:41 -05:00
Bryan Housel
419d1e124b Remove fromOnly highlighting (was confusing), try to simplify 2018-02-20 17:01:11 -05:00
Bryan Housel
7559ff68df Highlight all the paths when hoving on the from 2018-02-20 15:45:44 -05:00
Bryan Housel
bd46d0cc4a Highlight restriction when hovering on from 2018-02-20 13:57:51 -05:00
Bryan Housel
4ce0b62d05 Remove unneeded hover behavior, don't hover a way that can't be a FROM 2018-02-20 10:38:50 -05:00
Bryan Housel
eb3c1f07ec Always restyle a selected from way (don't reset it to grey) 2018-02-20 09:10:17 -05:00
Bryan Housel
200098dff9 Render restriction paths with red/green/blue shadow 2018-02-19 21:30:47 -05:00
Bryan Housel
d940200ef0 osmInferRestriction can just take a turn, instead of from/to
This is better because it makes explicit that osmInferRestriction
needs an actual turn now (from/to with vertex, etc)
2018-02-16 13:27:23 -05:00
Bryan Housel
aff9258dee Indirect restrictions now include only the partial path
This lets us properly infer the actual turn taken through the indirect
restriction using osmInferRestriction (an improvement over 5e9db0d)
2018-02-16 11:42:44 -05:00
Bryan Housel
5e9db0d409 Move help display code, fix display of indirect only restrictions
"indirect only" means an only restriction elsewhere in the intersection
that affects the selected from way.

    |     |
 ---+--F--+---
    A     |
 ---v--T--+---
    B     |

In the above example

 - 'only_straight_on' restriction "FROM way A VIA node V TO way B"
 - way F is selected

This would indirectly prevent a u-turn "FROM way F VIA way A TO way T"
We want to display the straight on restriction in the UI as
  "only_straight_on FROM way A VIA node V TO way B"
not
  "only_left_turn FROM way F VIA way A TO way B"
2018-02-16 00:03:04 -05:00
Bryan Housel
a2b6a3b09b Flag restriction as indirect if from doesn't match 2018-02-15 22:18:01 -05:00
Bryan Housel
f7e6eae065 Support Only Via paths, render indirect turn restriction with opacity 2018-02-15 17:27:45 -05:00
Bryan Housel
050907e252 Move event bindings to update selection, so callbacks use correct vars
When they are on the enter selection, they can stay "sticky" which has
the effect where you might move a slider and it puts the intersection
back to how it previously was (or returns to a previous intersection)
2018-02-15 08:27:39 -05:00
Bryan Housel
dbdbad29c2 Make sure container has dimensions the first time 2018-02-14 21:53:56 -05:00
Bryan Housel
0381bad22d Adjust constants, trying to avoid crunched turn indicator on leaf way 2018-02-13 17:45:45 -05:00
Bryan Housel
1612326ffa Move dist/via sliders to bottom, add imperial/metric conversion 2018-02-13 17:25:49 -05:00
Bryan Housel
1174424f50 Adjust padding and sizing constants, return to col4 sidebar
I really want the sidebar back to col4, so the user sees more main map.
This makes it very tricky to fit all of the intersection in the turn
restriction editor.
2018-02-12 15:35:45 -05:00
Bryan Housel
ca9aac501b Adjust text hint colors, change "Continue" to "Straight on" 2018-02-09 23:12:02 -05:00
Bryan Housel
957896656a Detail slider affects turns, but not geometry
(I decided that the larger context of the intersection is important and
shouldn't be hidden from the user)

Also
- show detail slider only if the intersection is complex
- hide the restriction editor completely if there is no real intersection
  (e.g. junction of `highway=path`)
2018-02-09 22:11:22 -05:00
Bryan Housel
4e1bafc221 Trying help text with color hint 2018-02-09 17:58:06 -05:00
Bryan Housel
3bd8d8d43d Style tweaks, persist max detail to localstorage 2018-02-09 17:39:36 -05:00
Bryan Housel
47eb5256cc WIP: add detail slider to restriction editor 2018-02-09 16:22:49 -05:00
Bryan Housel
0cbff57dc9 Cycle through only_ turn restriction states
(re: #2622)
2018-02-07 19:04:28 -05:00
Bryan Housel
3c340a0362 Trying out more intuitive restriction help message
- includes in the message the names of the streets
- also highlights related segments and nodes along the path

The messages are currently a bit rough:
  U-Turns FROM Black Horse Pike IS allowed...
  VIA Main Street TO Black Horse Pike
2018-02-07 17:00:53 -05:00
Bryan Housel
1007cfe252 Better calculation for fitting the whole intersection into view 2018-02-07 01:10:26 -05:00
Bryan Housel
aa7925a918 Extend leaf ways, so they don't stop within the viewport 2018-02-07 00:07:38 -05:00
Bryan Housel
c1378a141f Add support for complex intersection and via way restrictions 2018-02-02 19:58:09 -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
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