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.
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.
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.
- make icons a bit smaller
- also results in better vertical centering
- round icon too small for 3 digits, multiply width by digits
- increase opacity a bit for better readability
- with var instead of const all callbacks referenced last value in loop,
add closure
- cloning by property overwrites default when undefined, use L.extend
for Object.assign
- extend layer control to get current active layers (and more)
- access layer control in hash instead of static initial list
- use ',' layer separator and encode layers individually, so that comma
in layer name gets encoded and is not mistaken as separator as with '-'