[openstreetmap/openstreetmap-website] Split directions engine select into modes and providers (PR #5652)
Holger Jeromin
notifications at github.com
Thu Feb 20 08:04:39 UTC 2025
@HolgerJeromin commented on this pull request.
> - });
- }
-
- function setEngine(index) {
- chosenEngine = engines[index];
- select.val(index);
+ function setEngine(id) {
+ const engines = OSM.Directions.engines;
+ const desired = engines.find(engine => engine.id() === id);
+ if (!desired || (chosenEngine && chosenEngine.id() === id)) return;
+ chosenEngine = desired;
+
+ const modes = engines
+ .filter(engine => engine.provider === chosenEngine.provider)
+ .map(engine => engine.mode)
+ .sort((a, b) => I18n.t("javascripts.directions.modes." + a).localeCompare(I18n.t("javascripts.directions.modes." + b)));
Many maps are specific for one transport mode.
So having a fixed sort order can be problematic (osm data is also good for foot stuff).
That being said, alphabetically is probably the most the most neutral one...
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5652#discussion_r1963036470
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/5652/review/2628998224 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250220/9e633f39/attachment-0001.htm>
More information about the rails-dev
mailing list