Skip to content

Commit

Permalink
Merge pull request #380 from Shared-Reality-Lab/map-bug
Browse files Browse the repository at this point in the history
fix: map markers param
  • Loading branch information
jaydeepsingh25 committed May 4, 2024
2 parents 438d235 + 7dc9708 commit e0aa44f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/maps/maps-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,20 @@ function sendMapRequest(port: browser.Runtime.Port, map: HTMLIFrameElement, toRe
q = src.substring(i1, i2);
console.log(q);
}
if (src?.includes("&center=")) { // try to find center of map
if (src?.includes("&center=")) { // try to find center of map if center param is given
let i1 = src.indexOf("&center=") + 8;
let i2 = src.indexOf("&", i1) == -1 ? src.length : src.indexOf("&", i1);
let center = src.substring(i1, i2);
lat = center.split(",")[0];
lon = center.split(",")[1];
}
if (src?.includes("&markers=")) { // try to find center of map if markers param is given
let i1 = src.indexOf("&markers=") + 9;
let i2 = src.indexOf("&", i1) == -1 ? src.length : src.indexOf("&", i1);
let markers = decodeURIComponent(src.substring(i1, i2));
lat = markers.split(",")[0];
lon = markers.split(",")[1];
}
if (src?.includes("&zoom=")) { // try to find zoom of map
let i1 = src.indexOf("&zoom=") + 6;
let i2 = src.indexOf("&", i1) == -1 ? src.length : src.indexOf("&", i1);
Expand Down

0 comments on commit e0aa44f

Please sign in to comment.