Commit graph

568 commits

Author SHA1 Message Date
Henrik Fehlauer
e3a9f6206f Switch to next tab with Shift+T shortcut even if tab is currently closed
Often users can remember what the recently opened tab was, so we can
switch to and open the next tab immediately, saving one keypress. There
is a dedicated shortcut (T) for only opening a tab, after all.

While the previous behavior for Shift+T (open tab without switching to
next if currently closed) was by intention, user testing found that the
new approach might be more desirable.
2020-06-20 18:00:00 +00:00
Henrik Fehlauer
8a66a816f7 Run yarn lint, yarn prettier and yarn build i18next
0d6cd61 was still missing some style fixes, making `yarn` touch
unrelated files on a subsequent `git commit`.
2020-06-18 18:00:00 +00:00
Norbert Renner
77f1b5f0af
Merge pull request #314 from rkflx/pr/add-and-fix-shortcuts
Add more keyboard shortcuts and fix various shortcut related issues
2020-06-19 21:26:13 +02:00
The Ripper
0d6cd61b1f
Load Track from file and add as Route (#312) 2020-06-19 18:19:42 +02:00
Henrik Fehlauer
b8b1e436e6 Add shortcut to toggle elevation chart
Press 'E' to show/hide the elevation chart.
2020-06-14 18:00:00 +00:00
Henrik Fehlauer
844a9038ee Add shortcuts to toggle sidebar and switch tabs
The 'T' key will show/hide the most recent sidebar tab.

Pressing 'Shift+T' will switch to the next sidebar tab, possibly
wrapping around to the first tab.

If the Itinerary tab is hidden, it will be skipped.
2020-06-13 18:00:00 +00:00
Henrik Fehlauer
e56d213931 Add shortcut to show about dialog
Press 'H' to get to the helpful about dialog.
2020-06-12 18:00:00 +00:00
Henrik Fehlauer
d106552ad3 Add shortcuts to load tracks and no-go areas
Press 'O' or 'Shift+O' to open/load tracks or no-go areas respectively.
2020-06-11 18:00:00 +00:00
Henrik Fehlauer
a420ad5c0b Add shortcut to export route
Press 'X' to trigger the export route dialog.

Automatically populating the trackname field should work too.
2020-06-10 18:00:00 +00:00
Henrik Fehlauer
6da520ed4d Add shortcut to toggle profile switcher
Press 'G' to open the profile switcher, select a profile with the arrow
keys, apply with 'Enter' and close the switcher with 'Escape'.

While 'T' and 'P' will be / were already taken, 'G' is at least easily
reachable with the left hand for users using a mouse with their right
hand at the same time.

Since Bootstrap keeps updating the tooltip when changing options in the
dropdown (which is useful in case the text is longer than the width of
the control), the shortcut text needs to be applied dynamically too.
2020-06-09 18:00:00 +00:00
Henrik Fehlauer
ba0bb39fd5 Add shortcut to toggle Strava layer
Press 'S' to show the Strava buttons (if the API key has been set) as
well as the Strava segments layer (once it has been fetched).

Note that fetching and updating data from Strava still needs to be
triggered manually by clicking the respective biking or running button.
2020-06-08 18:00:00 +00:00
Henrik Fehlauer
e4e1c8a19e Add shortcut for clear route dialog
Use 'Backspace' to show the dialog allowing to clear the route.

The 'Del' key could then be used in the future to possibly allow to
delete individual selected items like POIs or no-go areas.
2020-06-07 18:00:00 +00:00
Henrik Fehlauer
29530919b5 Stop deleting points once there are no more points left
Prevents "Uncaught TypeError: Cannot read property 'off' of null"
in L.Routing.js
2020-06-06 18:00:00 +00:00
Henrik Fehlauer
48f8fe3524 Add shortcut to delete last point
Press 'Z' to undo adding the last point.
2020-06-05 18:00:00 +00:00
Henrik Fehlauer
a852acbfce Add shortcut to create no-go areas
Press 'N' to initiate drawing a no-go area. 'Escape' will cancel,
similar to how drawing a route works.
2020-06-04 18:00:00 +00:00
Henrik Fehlauer
2848e4dd36 Add shortcut to reverse route
Press 'R' to swap start and end of the route.
2020-06-03 18:00:00 +00:00
Henrik Fehlauer
37ab05310b Add shortcut for geocoder search field
Press 'F', type a query and press 'Enter' to find places effortlessly.

Note that the button already triggers on mousedown events, even though
by convention it should react on mouseup (i.e. a regular click)
only. However, that's an issue in the external dependency, and can
be worked around for now.
2020-06-02 18:00:00 +00:00
Henrik Fehlauer
f23e3751b5 Allow translation of the search field placeholder text
It was not translated before, since the string was coming from an
external dependency.
2020-06-01 18:00:00 +00:00
Henrik Fehlauer
fd97019fdc Add shortcut to trigger geolocation
Press 'L' to initiate the "Show me where I am" function.
2020-05-31 18:00:00 +00:00
Henrik Fehlauer
8e78c858c1 Add shortcut to toggle color coding button
Press 'C' repeatedly to switch between the various color coding options.
When the last one is reached, we show the regular route again.
2020-05-30 18:00:00 +00:00
Henrik Fehlauer
d6c648d3eb Fix mute shortcut not working for color coded routes
The mute shortcut would only work for regular routes before.

Note that no-go areas, POIs and tracks continue to be unaffected
by muting, so e.g. peeking at a track below the route is still possible.
2020-05-29 18:00:00 +00:00
Henrik Fehlauer
08c8cfa8be Prevent more accidental shortcut triggers
Do not allow browser keyboard shortcuts to trigger route functions,
e.g. pressing Ctrl+P triggers printing in most browsers, but should not
at the same time switch BRouter-Web to POI mode. This can be prevented
by filtering for modifiers.

In the same fashion, when modal dialogs or dropdowns are open it should
not be possible to activate map functions in the background now.

Finally, inhibit shortcuts in number input fields too, as found in the
editable number input fields in the customize profile options.
Previously only regular text input fields were protected.

To make those checks easier to use, they are deduplicated and moved to
Util.js.
2020-05-28 18:00:00 +00:00
Henrik Fehlauer
36d8a207ab Convert all shortcuts to act on keydown already
Contrary to mouse clicks, when pressing keys on a keyboard the
standard behavior is to perform the associated action immediately,
not only when releasing the key again. This should also improve the
perceived performance slightly.

Note that the 'D' shortcut had formerly been handled by Leaflet, which
we now have to do on our own.

While at it, move the character codes over to the options variable, as
found in other parts of the codebase already.

Also removing the listener from the container does not seem needed
anymore nowadays.
2020-05-26 18:00:00 +00:00
Henrik Fehlauer
8e65d6a3dd Show analysis table highlight above quality coding layer (#304)
When hovering over rows in the analysis tab, highlighted sections for
the route could only be seen on the regular route, but not when any of
the color-coded route visualisations were selected.

Patch based on a similar fix for data table in d33c795200.
2020-05-25 18:00:00 +00:00
Henrik Fehlauer
8ca92e260d Improve analysis tab CSS
There are some ways the look of the analysis tab can be polished:
- Properly right-align the length header
  (it had extra margins required for the sorting arrows in the data tab)
- Use the same font size for table header and body (like in the data tab)
- Improve padding of the totals row (to align with the rows above)
- Add missing style for headings, so they look more balanced
  (the CSS was already there, but the wrong class was used in the HTML)
- Fine-tune vertical spacing (to help visual grouping)
- Remove unused and redundant CSS
- Do not show yellow hover effect over table header
2020-05-24 18:00:00 +00:00
Henrik Fehlauer
9d648fc1d7 Make hotline contrast more pleasant
Colorful routes can conflict visually with colourful maps, therefore
having an outline to make the route stand out more makes sense.

However, using black results in very high contrast levels, which can
become distracting in itself. By using a dark gray, this should look
much more balanced, while still fulfilling the original purpose.
2020-05-23 18:00:00 +00:00
Henrik Fehlauer
900f925276 Improve incline coding visuals and use different colors for going uphill
Currently it is a bit difficult to guess the slope of the route for
planning purposes, since even for routes in very hilly terrain the
colors hardly change. Only extremely steep hills are indicated,
and there is no visual difference between going uphill or downhill.

By cutting off earlier, more of the route will show meaningful
differences in color. Note that BRouter's gradients are already
averaged compared to the maximum gradients shown on road signs, so 15%
should be a good compromise (anything steeper is difficult to ride on
for longer periods anyway, and rightly deserves to be colored with an
alarming red).

By using different colors for the min and max parameters, uphill and
downhill sections should now be easy to distinguish.

By introducing two more color stops, the gradient becomes much smoother,
with flat sections featuring a distinctive green, where they were drawn
in a muddy dark green before.

Note that this approach had been implemented like this in QLandkarte GT
for several years now, with great success.
2020-05-22 18:00:00 +00:00
Norbert Renner
71317b84e4 Fix analysis sorting
Return value of the sort compare function is defined as value less, equal or greater than 0, not as boolean.
2020-06-12 10:57:41 +02:00
Marcus Jaschen
fc54c65e23 Add sidebar tab with route analysis data
- adds a new analysis tab in the sidebar
- the analysis tab shows length distribution for different way types, surface, and smoothness
- table rows can be hovered/clicked to highlight the according segments on the map (similar behaviour as the detailed data table)
- localization is implemented for `de` and `en`
- the method for finding segment edges was extracted from `js/control/TrackMessages.js` into `js/util/TrackEdges.js` as it's used in the new analysis class too (the Gulp config was changed to reflect that)

Notes:

I had the idea to use the *DataTable* plugin for rendering the tables but decided against it. The only meaningful way to sort such a table is by the length column and that's already the case. So it's just three plain, old HTML tables, rendered by jQuery.

For meaningful statistics the `processUnusedTags` setting has to be enabled in the routing profile. Only in this case the BRouter backend includes all needed tags (`highway`, `surface`, and `smoothness`) for *every* route segment in the response. I’ve enabled that setting for all profiles at my BRouter-web instance at <https://brouter.m11n.de/>.
2020-06-07 16:56:50 +02:00
Stefan Siegl
64202a451c
Allow to mute route 2020-06-06 21:47:58 +02:00
Norbert Renner
32d4a26dfd Fix nogo drawing for mobile Chrome, fixes #259 2020-06-05 20:11:36 +02:00
Norbert Renner
f197fb31be Exclude loaded tracks from URL hash 2020-06-03 20:24:17 +02:00
Norbert Renner
9fd9a52a8c Set track color yellow for CyclOSM (#297) 2020-06-02 22:09:22 +02:00
Norbert Renner
e5e876f717 Make privacy policy URL configurable (#284) 2020-05-28 10:54:08 +02:00
Norbert Renner
1b66989cfb
Merge pull request #292 from tbsmark86/master
Fix: Profile params of type 'select' ignored default value from profile
2020-05-27 08:27:35 +02:00
Norbert Renner
b11c182a29 Fix route drag on mobile for Leaflet 1.6.0 (#285) 2020-05-26 12:27:32 +02:00
Gautier P
bbaad4f8b3 Hide stats footer by default and collapse elevation chart if needed 2020-05-25 20:22:49 +02:00
Gautier P
92ad30be17 Hide zoom controls on mobile 2020-05-24 21:24:14 +02:00
Gautier P
a358aed464 Improve stats footer on mobile #296 2020-05-24 19:50:14 +02:00
Gautier P
52be57f5ba Always display 3 digits for distance title, even when ending with zeros 2020-05-24 19:23:00 +02:00
Tobias
3457f92fbf Fix: Profile params of type 'select' ignored default value from profile 2020-05-13 17:14:53 +02:00
Gautier P
23b5439159 Keep fallback values in code in case config.js is not updated with new required fields 2020-04-14 18:44:05 +02:00
Robert Sacks
e91b22ede0 Add config option for initial map position and zoom 2020-04-14 18:42:48 +02:00
Norbert Renner
86d42de458 Show icon indicator when profile is pinned (modified in editor) 2020-02-07 20:02:32 +01:00
Norbert Renner
c94a530f49 Fix overwriting editor changes when switching profile tabs 2020-02-06 20:27:57 +01:00
Norbert Renner
07425148ee Set custom profileName after post
Otherwise next cache get after tab switching still uses original profile
2020-02-05 19:59:55 +01:00
Norbert Renner
164431dccb Fix "Layer not found: route-quality" error msg (ignore built-in layers) 2020-01-08 19:13:15 +01:00
Norbert Renner
83ffa4091d Fix errors when profilesUrl is not defined in config (text undefined) 2020-01-02 13:36:33 +01:00
Norbert Renner
502735cb8e
Replace large awesome-markers with smaller vector-markers (#268) 2019-12-18 21:28:58 +01:00
Norbert Renner
9af707a56e Set loaded markers non-interactive, below route markers (#240) 2019-12-13 14:45:58 +01:00