86 Commits

Author SHA1 Message Date
Martin Raifer
ea47581bae show turn restriction editor also when there is only one _to_ way, fixes #9983
as there might exist turn restrictions with that way as _via_.
2023-11-22 16:39:47 +01:00
Martin Raifer
4fb490abfa fix rendering of html content in turn restriction editor 2022-02-11 17:24:21 +01:00
Martin Raifer
9f3f8e1366 rename method 2021-11-29 19:26:18 +01:00
Martin Raifer
54886339f6 fix code lint issue, move additional logic into display methods 2021-11-29 19:21:29 +01:00
Martin Raifer
f3d05e4b01 fix restrictions field and global search results 2021-11-29 19:09:10 +01:00
Martin Raifer
d78c357588 replace raw html injection of localized texts
by using d3 to insert the localized text spans directly into the DOM
2021-11-26 18:51:45 +01:00
Martin Raifer
2f9285e011 improve rendering of turn-restriction boxes in narrow sidebars
Previously the applied paddings were too large for narrow sidebars, causing the turn-restriction min-map view to be much more zoomed out than needed.
This tweaks the paddings such that even for the slimmest sidebar the rendering is still acceptable (i.e. no turn arrows to be rendered completely outside of the viewport) and at the same time allows generous margins for wider sidebars.

This also fixes a minor bug where the mini-map is not properly alligned vertically
2021-11-05 14:46:53 +01:00
Quincy Morgan
ba48a861bc Enable curly and block-spacing eslint rules 2020-11-10 14:19:11 -05:00
Quincy Morgan
4059ee5118 Enable block-scoped-var eslint rule 2020-10-23 13:38:36 -04:00
Quincy Morgan
21a49bbec8 Initial support for D3 v6.2.0 2020-10-06 15:08:39 -04:00
Quincy Morgan
79b6a9d863 Add lang attribute to text in turn restriction editor (re: #7963) 2020-09-29 16:38:23 -04:00
Quincy Morgan
5435082d9c Revert t function to returning the plain string by default
Add `t.html` function for getting the string with the `lang` attribute
2020-09-22 12:03:29 -04:00
Quincy Morgan
32f8274929 Make t function return a span element with a lang attribute unless html: false is specified in the options (re: #7963)
Update `text` functions to `html` to support inserting the `span` elements
Specify `html: false` for various instances where a `span` is not desired, e.g. `placeholder` and `title` attributes
2020-09-15 21:56:22 -04:00
Quincy Morgan
60f7dc7c0b Replace presets property of context with singleton
Remove utilPreset
2020-04-01 13:08:45 -07:00
Quincy Morgan
a58abe3c6f Move localStorage interface from a property of coreContext to a corePreferences function 2020-04-01 11:00:48 -07:00
Quincy Morgan
a1af118f0e Ensure locales and presets are loaded before the UI loads (close #7406)
Consolidate localization behavior and init to a coreLocalizer function and singleton
Explicitly support `en-US` locale
Rename coreData to coreFileFetcher and export a singleton rather than using a property of coreContext
Add `apiConnections` property of coreContext to simplify adding a source switcher
Replace some init functions with re-callable, promise-supporting `ensureLoaded` functions
Make coreContext itself load the UI if a container has been specified at init time
Fix code tests
2020-03-31 12:23:31 -07:00
Quincy Morgan
0931459dba Reduce use of global selection (re: #7445) 2020-03-24 13:02:06 -07:00
Quincy Morgan
152d89fa22 Convert some element ids to classes to avoid collisions when embedding iD 2020-03-20 13:10:39 -07:00
Quincy Morgan
1b331bb678 Add mechanism for fields to support editing during multiselection (re: #7276)
Add `utilCombinedTags` method and use it for the raw tag editor as well as fields
Pass `entityIDs` array into fields instead of single `entity` object
Give field revertion its own path separate from `change`
Add multiselection editing to fields in files: access, address, check, combo, cycleway, input, maxspeed, textarea, and wikidata
2020-01-30 13:53:29 -05:00
Bryan Housel
693661a658 Default TR to via-node only, use new key so everyone must re-choose
(closes #6922)
2019-11-11 14:47:29 -05:00
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