diff --git a/GuildWarsPartySearch.FrontEnd/Content/app.js b/GuildWarsPartySearch.FrontEnd/Content/app.js
index 86f27c2..0b6e434 100644
--- a/GuildWarsPartySearch.FrontEnd/Content/app.js
+++ b/GuildWarsPartySearch.FrontEnd/Content/app.js
@@ -944,7 +944,7 @@ async function buildPartyList() {
}
}
-async function navigateToLocation(mapObj) {
+async function navigateToLocation(mapObj, showParties) {
for (const continentData of leafletData) {
if (!continentData.regions) {
continue;
@@ -967,9 +967,26 @@ async function navigateToLocation(mapObj) {
return;
}
+ var pixelBounds = map.getPixelBounds();
+ var desiredBounds = pixelBounds.getSize().divideBy(2);
+ var quarterSize = pixelBounds.getSize().divideBy(4);
+ var center = L.point(pixelBounds.min.x + desiredBounds.x, pixelBounds.min.y + desiredBounds.y)
+
+ var reducedPixelBounds = L.bounds(L.point(center.x - quarterSize.x, center.y - quarterSize.y), L.point(center.x + quarterSize.x, center.y + quarterSize.y));
+ if (reducedPixelBounds.contains(location.coordinates)) {
+ mapClicked(location);
+ return;
+ }
+
setURLParameter("navigating", "1");
- map.panTo(location.coordinates);
- mapClicked(location);
+ map.setView(location.coordinates, 2, { animate: true, duration: 1 });
+ await waitMillis(1000);
+ map.setZoom(map.getMaxZoom(), { animate: true, duration: 1 });
+ await waitMillis(1000);
+ if (showParties) {
+ mapClicked(location);
+ }
+ resetURLParameter("navigating");
return; // Assuming you only want to navigate to the first match
}
}
@@ -979,9 +996,7 @@ async function navigateToLocation(mapObj) {
function mapRowClicked(mapObj) {
window.location.hash = mapObj.name;
- navigateToLocation(mapObj);
- showPartyWindow();
- buildPartyWindow();
+ navigateToLocation(mapObj, true);
}
function hidePartyWindowRows(rowType) {
@@ -1180,10 +1195,7 @@ function loadMap(mapIndex) {
}
}).on('click focus movestart', function () {
hideMenu();
- if (getURLParameter("navigating") == "1") {
- resetURLParameter("navigating");
- }
- else {
+ if (!getURLParameter("navigating") == "1") {
hidePartyWindow();
}
});
@@ -1427,6 +1439,12 @@ async function waitForLoaded(){
}
}
+async function waitMillis(millis) {
+ return new Promise(resolve => {
+ setTimeout(resolve, millis);
+ });
+}
+
function togglePartyWindow(){
document.querySelector("#partyWindow").classList.toggle("hidden");
}
diff --git a/GuildWarsPartySearch.FrontEnd/Content/index.html b/GuildWarsPartySearch.FrontEnd/Content/index.html
index fc0430e..2956f52 100644
--- a/GuildWarsPartySearch.FrontEnd/Content/index.html
+++ b/GuildWarsPartySearch.FrontEnd/Content/index.html
@@ -14,10 +14,10 @@
-
+
-
+
@@ -86,6 +86,6 @@
-
+