Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed unable to navigate to POIs #179

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions res/huroutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ const huroutes = {
// Undocumented URI for multi-waypoint route planning.
// The double-slash after dir means an unknown starting coordinate.
// The data means determine starting location and start directions.
if (!wpts.length)
return huroutes.opt.navLinkProviders.Google.getLink(dst);
const link = 'https://www.google.com/maps/dir//{0}/{1},{2}/data=!4m6!4m5!1m1!4e2!1m0!1m0!3e0';
return link.format(wpts.map(c => c.lat + ',' + c.lng).join('/'), dst.lat, dst.lng);
},
Expand Down Expand Up @@ -88,6 +90,8 @@ const huroutes = {
},
'HERE WeGo follow route': {
'getLink': (dst, wpts) => {
if (!wpts.length)
return huroutes.opt.navLinkProviders['HERE WeGo'].getLink(dst);
const link = 'https://share.here.com/g/{0}/{1},{2}?m=d';
return link.format(wpts.map(c => c.lat + ',' + c.lng).join('/'), dst.lat, dst.lng);
},
Expand Down Expand Up @@ -724,7 +728,7 @@ var navigation = {
_getProv: function() { return this.provs[this.getId()]; },
/** Returns a set of waypoints as requested by the link provider. */
_getWaypoints: function(coords, reverse) {
const count = this._getProv().waypoints;
const count = Math.min(this._getProv().waypoints, coords.length - 1);
if (!count)
return [];
let idx = reverse ? coords.length - 1 : 0;
Expand Down Expand Up @@ -792,7 +796,7 @@ function addPoiLinks(elem, title, coord)
{
var eLinks = $('<p> {0} {1}</p>'.format(langDict.navToPoi, langDict.sharePoi));
var eNav = eLinks.find('.nav-start');
eNav.replaceWith($('<a href="#" />').append(eNav.html()).click(() => planTo(coord)));
eNav.replaceWith($('<a href="#" />').append(eNav.html()).click(() => planTo([coord])));
var eShare = eLinks.find('.share');
eShare.replaceWith($('<a href="#" />').append(eShare.html()).click(() => {
navigator.share({
Expand Down
Loading