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.
Those shortcuts were already working before, but not really
discoverable for users.
To achieve a consistent UI and keep the wording in line with existing
conventions and future shortcuts (i.e. no whole sentences, shortcut in
parenthesis), the mute tooltip is changed again to occupy two lines (to
limit the width of the tooltip), to be less wordy (so it is faster to
read), to use the "mute" term (to help memorizing the M shortcut, at
least in English), and to align with the parenthesis style.
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.
- 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/>.
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.
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
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.
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.
The privacy link now is relative to the site that it is hosted on
When opening the about page at brouter-web the privacy link left down in the corner is a relative one to https://brouter.de/privacypolicy.html. When running an own instance I think it should link the that page, because the operator could have other terms, for example time for saving logs. So you shoud change that to a relative path to /privacypolicy.html so every operator can have another text.
You could also include a standard privacypolicy.html and put it to /brouter-web/privacypolicy.html so it can be customized if needed.