fix the marker storage & clearing logic, and add the second profile map when used
This commit is contained in:
@@ -2,6 +2,8 @@ export interface UserProfile {
|
|||||||
description: string;
|
description: string;
|
||||||
locLat?: number;
|
locLat?: number;
|
||||||
locLon?: number;
|
locLon?: number;
|
||||||
|
locLat2?: number;
|
||||||
|
locLon2?: number;
|
||||||
issuerDid: string;
|
issuerDid: string;
|
||||||
rowId?: string; // set on profile retrieved from server
|
rowId?: string; // set on profile retrieved from server
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<section id="Content" class="p-6 pb-24 max-w-3xl mx-auto">
|
<section id="Content" class="p-6 pb-24 max-w-3xl mx-auto">
|
||||||
<!-- Breadcrumb -->
|
<!-- Breadcrumb -->
|
||||||
<div id="ViewBreadcrumb" class="mb-8">
|
<div id="ViewBreadcrumb" class="mb-8">
|
||||||
<h1 class="text-lg text-center font-light relative px-7">
|
<h1 id="ViewHeading" class="text-lg text-center font-light relative px-7">
|
||||||
<!-- Back -->
|
<!-- Back -->
|
||||||
<button
|
<button
|
||||||
@click="$router.go(-1)"
|
@click="$router.go(-1)"
|
||||||
|
|||||||
@@ -459,18 +459,7 @@ export default class DiscoverView extends Vue {
|
|||||||
this.userProfiles = [];
|
this.userProfiles = [];
|
||||||
const plans: PlanData[] = results.data;
|
const plans: PlanData[] = results.data;
|
||||||
if (plans) {
|
if (plans) {
|
||||||
for (const plan of plans) {
|
this.projects.push(...plans);
|
||||||
const { name, description, handleId, image, issuerDid, rowId } =
|
|
||||||
plan;
|
|
||||||
this.projects.push({
|
|
||||||
name,
|
|
||||||
description,
|
|
||||||
handleId,
|
|
||||||
image,
|
|
||||||
issuerDid,
|
|
||||||
rowId,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this.remoteCount = this.projects.length;
|
this.remoteCount = this.projects.length;
|
||||||
} else {
|
} else {
|
||||||
throw JSON.stringify(results);
|
throw JSON.stringify(results);
|
||||||
@@ -562,22 +551,9 @@ export default class DiscoverView extends Vue {
|
|||||||
|
|
||||||
if (this.isProjectsActive) {
|
if (this.isProjectsActive) {
|
||||||
this.userProfiles = [];
|
this.userProfiles = [];
|
||||||
if (results.data) {
|
const plans: PlanData[] = results.data;
|
||||||
if (beforeId) {
|
if (plans) {
|
||||||
const plans: PlanData[] = results.data;
|
this.projects.push(...plans);
|
||||||
for (const plan of plans) {
|
|
||||||
const { name, description, handleId, issuerDid, rowId } = plan;
|
|
||||||
this.projects.push({
|
|
||||||
name,
|
|
||||||
description,
|
|
||||||
handleId,
|
|
||||||
issuerDid,
|
|
||||||
rowId,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.projects = results.data;
|
|
||||||
}
|
|
||||||
this.localCount = this.projects.length;
|
this.localCount = this.projects.length;
|
||||||
} else {
|
} else {
|
||||||
throw JSON.stringify(results);
|
throw JSON.stringify(results);
|
||||||
@@ -626,7 +602,7 @@ export default class DiscoverView extends Vue {
|
|||||||
} else if (this.isAnywhereActive) {
|
} else if (this.isAnywhereActive) {
|
||||||
this.searchAll(latestProject.rowId);
|
this.searchAll(latestProject.rowId);
|
||||||
}
|
}
|
||||||
} else if (!this.isProjectsActive && this.userProfiles.length > 0) {
|
} else if (this.isPeopleActive && this.userProfiles.length > 0) {
|
||||||
const latestProfile = this.userProfiles[this.userProfiles.length - 1];
|
const latestProfile = this.userProfiles[this.userProfiles.length - 1];
|
||||||
if (this.isLocalActive || this.isMappedActive) {
|
if (this.isLocalActive || this.isMappedActive) {
|
||||||
this.searchLocal(latestProfile.rowId || "");
|
this.searchLocal(latestProfile.rowId || "");
|
||||||
@@ -637,6 +613,11 @@ export default class DiscoverView extends Vue {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearMarkers() {
|
||||||
|
Object.values(this.markers).forEach((marker) => marker.remove());
|
||||||
|
this.markers = {};
|
||||||
|
}
|
||||||
|
|
||||||
async onMapReady(map: L.Map) {
|
async onMapReady(map: L.Map) {
|
||||||
// doing this here instead of the l-map element avoids a recentering after the first drag
|
// doing this here instead of the l-map element avoids a recentering after the first drag
|
||||||
map.setView([this.localCenterLat, this.localCenterLong], 2);
|
map.setView([this.localCenterLat, this.localCenterLong], 2);
|
||||||
@@ -662,8 +643,7 @@ export default class DiscoverView extends Vue {
|
|||||||
|
|
||||||
onZoomStart(/* event: L.LocationEvent */) {
|
onZoomStart(/* event: L.LocationEvent */) {
|
||||||
// remove markers because otherwise they jump around at zoom end
|
// remove markers because otherwise they jump around at zoom end
|
||||||
Object.values(this.markers).forEach((marker) => marker.remove());
|
this.clearMarkers();
|
||||||
this.markers = {};
|
|
||||||
|
|
||||||
this.zoomedSoDoNotMove = true;
|
this.zoomedSoDoNotMove = true;
|
||||||
}
|
}
|
||||||
@@ -686,8 +666,7 @@ export default class DiscoverView extends Vue {
|
|||||||
: this.partnerApiServer + "/api/partner/userProfileCountsByBBox";
|
: this.partnerApiServer + "/api/partner/userProfileCountsByBBox";
|
||||||
const response = await fetch(endpoint + "?" + queryParams);
|
const response = await fetch(endpoint + "?" + queryParams);
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
Object.values(this.markers).forEach((marker) => marker.remove());
|
this.clearMarkers();
|
||||||
this.markers = {};
|
|
||||||
const results = await response.json();
|
const results = await response.json();
|
||||||
if (results.data?.tiles?.length > 0) {
|
if (results.data?.tiles?.length > 0) {
|
||||||
for (const tile: Tile of results.data.tiles) {
|
for (const tile: Tile of results.data.tiles) {
|
||||||
@@ -711,10 +690,22 @@ export default class DiscoverView extends Vue {
|
|||||||
};
|
};
|
||||||
this.searchLocal();
|
this.searchLocal();
|
||||||
});
|
});
|
||||||
this.markers["" + tile.indexLat + "X" + tile.indexLon] = marker;
|
this.markers[
|
||||||
|
"" +
|
||||||
|
tile.indexLat +
|
||||||
|
"X" +
|
||||||
|
tile.indexLon +
|
||||||
|
"_" +
|
||||||
|
tile.minFoundLat +
|
||||||
|
"X" +
|
||||||
|
tile.minFoundLon +
|
||||||
|
"-" +
|
||||||
|
tile.maxFoundLat +
|
||||||
|
"X" +
|
||||||
|
tile.maxFoundLon
|
||||||
|
] = marker;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await this.searchLocal();
|
|
||||||
} else {
|
} else {
|
||||||
throw {
|
throw {
|
||||||
message: "Got an error loading projects on the map.",
|
message: "Got an error loading projects on the map.",
|
||||||
|
|||||||
@@ -4,9 +4,19 @@
|
|||||||
|
|
||||||
<!-- CONTENT -->
|
<!-- CONTENT -->
|
||||||
<section id="Content" class="p-6 pb-24 max-w-3xl mx-auto">
|
<section id="Content" class="p-6 pb-24 max-w-3xl mx-auto">
|
||||||
<h1 id="ViewHeading" class="text-4xl text-center font-light">
|
<!-- Breadcrumb -->
|
||||||
Individual Profile
|
<div id="ViewBreadcrumb" class="mb-8">
|
||||||
</h1>
|
<h1 id="ViewHeading" class="text-lg text-center font-light relative px-7">
|
||||||
|
<!-- Back -->
|
||||||
|
<button
|
||||||
|
@click="$router.go(-1)"
|
||||||
|
class="text-lg text-center px-2 py-1 absolute -left-2 -top-1"
|
||||||
|
>
|
||||||
|
<fa icon="chevron-left" class="fa-fw"></fa>
|
||||||
|
</button>
|
||||||
|
Individual Profile
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Loading Animation -->
|
<!-- Loading Animation -->
|
||||||
<div
|
<div
|
||||||
@@ -28,7 +38,7 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Map -->
|
<!-- Map for first coordinates -->
|
||||||
<div v-if="profile?.locLat && profile?.locLon" class="mt-4">
|
<div v-if="profile?.locLat && profile?.locLon" class="mt-4">
|
||||||
<h2 class="text-lg font-semibold">Location</h2>
|
<h2 class="text-lg font-semibold">Location</h2>
|
||||||
<div class="h-96 mt-2 w-full">
|
<div class="h-96 mt-2 w-full">
|
||||||
@@ -50,6 +60,29 @@
|
|||||||
</l-map>
|
</l-map>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Map for second coordinates -->
|
||||||
|
<div v-if="profile?.locLat2 && profile?.locLon2" class="mt-4">
|
||||||
|
<h2 class="text-lg font-semibold">Second Location</h2>
|
||||||
|
<div class="h-96 mt-2 w-full">
|
||||||
|
<l-map
|
||||||
|
ref="profileMap"
|
||||||
|
:center="[profile.locLat2, profile.locLon2]"
|
||||||
|
:zoom="12"
|
||||||
|
>
|
||||||
|
<l-tile-layer
|
||||||
|
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
||||||
|
layer-type="base"
|
||||||
|
name="OpenStreetMap"
|
||||||
|
/>
|
||||||
|
<l-marker :lat-lng="[profile.locLat2, profile.locLon2]">
|
||||||
|
<l-popup>{{
|
||||||
|
didInfo(profile.issuerDid, activeDid, allMyDids, allContacts)
|
||||||
|
}}</l-popup>
|
||||||
|
</l-marker>
|
||||||
|
</l-map>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else class="text-center mt-8">
|
<div v-else class="text-center mt-8">
|
||||||
|
|||||||
Reference in New Issue
Block a user