Browse Source

show results for project map grouping when clicked

split_build_process
Trent Larson 3 weeks ago
parent
commit
56bbc3f4cc
  1. 35
      src/views/DiscoverView.vue

35
src/views/DiscoverView.vue

@ -44,6 +44,7 @@
isMappedActive = false; isMappedActive = false;
isRemoteActive = false; isRemoteActive = false;
isSearchVisible = true; isSearchVisible = true;
tempSearchBox = null;
searchLocal(); searchLocal();
" "
v-bind:class="computedLocalTabStyleClassNames()" v-bind:class="computedLocalTabStyleClassNames()"
@ -59,7 +60,6 @@
--> -->
</a> </a>
</li> </li>
<!--
<li> <li>
<a <a
href="#" href="#"
@ -69,13 +69,14 @@
isMappedActive = true; isMappedActive = true;
isRemoteActive = false; isRemoteActive = false;
isSearchVisible = false; isSearchVisible = false;
searchTerms = '';
tempSearchBox = null;
" "
v-bind:class="computedMappedTabStyleClassNames()" v-bind:class="computedMappedTabStyleClassNames()"
> >
Mapped Mapped
</a> </a>
</li> </li>
-->
<li> <li>
<a <a
href="#" href="#"
@ -85,6 +86,7 @@
isMappedActive = false; isMappedActive = false;
isRemoteActive = true; isRemoteActive = true;
isSearchVisible = true; isSearchVisible = true;
tempSearchBox = null;
searchAll(); searchAll();
" "
v-bind:class="computedRemoteTabStyleClassNames()" v-bind:class="computedRemoteTabStyleClassNames()"
@ -115,7 +117,7 @@
</div> </div>
</div> </div>
<div v-if="isMappedActive"> <div v-if="isMappedActive && !tempSearchBox">
<div class="mt-4 h-96 w-5/6 mx-auto"> <div class="mt-4 h-96 w-5/6 mx-auto">
<l-map <l-map
ref="projectMap" ref="projectMap"
@ -250,6 +252,7 @@ export default class DiscoverView extends Vue {
markers: { [key: string]: L.Marker } = {}; markers: { [key: string]: L.Marker } = {};
remoteCount = -1; remoteCount = -1;
searchBox: { name: string; bbox: BoundingBox } | null = null; searchBox: { name: string; bbox: BoundingBox } | null = null;
tempSearchBox: BoundingBox | null = null;
zoomedSoDoNotMove = false; zoomedSoDoNotMove = false;
// make this function available to the Vue template // make this function available to the Vue template
@ -384,7 +387,11 @@ export default class DiscoverView extends Vue {
public async searchLocal(beforeId?: string) { public async searchLocal(beforeId?: string) {
this.resetCounts(); this.resetCounts();
if (!this.searchBox) { const searchBox =
(this.isMappedActive && this.tempSearchBox) ||
(this.isLocalActive && this.searchBox?.bbox);
if (!searchBox) {
this.projects = []; this.projects = [];
return; return;
} }
@ -399,10 +406,10 @@ export default class DiscoverView extends Vue {
let queryParams = [ let queryParams = [
claimContents, claimContents,
"minLocLat=" + this.searchBox.bbox.minLat, "minLocLat=" + searchBox.minLat,
"maxLocLat=" + this.searchBox.bbox.maxLat, "maxLocLat=" + searchBox.maxLat,
"westLocLon=" + this.searchBox.bbox.westLong, "westLocLon=" + searchBox.westLong,
"eastLocLon=" + this.searchBox.bbox.eastLong, "eastLocLon=" + searchBox.eastLong,
].join("&"); ].join("&");
if (beforeId) { if (beforeId) {
@ -483,7 +490,7 @@ export default class DiscoverView extends Vue {
if (this.isLocalActive) { if (this.isLocalActive) {
this.searchLocal(latestProject["rowid"]); this.searchLocal(latestProject["rowid"]);
} else if (this.isMappedActive) { } else if (this.isMappedActive) {
// don't do anything since mapped items only show a limited number this.searchLocal(latestProject["rowid"]);
} else if (this.isRemoteActive) { } else if (this.isRemoteActive) {
this.searchAll(latestProject["rowid"]); this.searchAll(latestProject["rowid"]);
} }
@ -544,11 +551,21 @@ export default class DiscoverView extends Vue {
}); });
const marker = L.marker([pinLat, pinLon], { icon: numberIcon }); const marker = L.marker([pinLat, pinLon], { icon: numberIcon });
marker.addTo(targetMap); marker.addTo(targetMap);
marker.on("click", () => {
this.tempSearchBox = {
minLat: tile.minFoundLat,
maxLat: tile.maxFoundLat,
westLong: tile.minFoundLon,
eastLong: tile.maxFoundLon,
};
this.searchLocal();
});
this.markers[ this.markers[
"" + tile.indexLat + "X" + tile.indexLon + "*" + tile.recordCount "" + tile.indexLat + "X" + tile.indexLon + "*" + tile.recordCount
] = marker; ] = 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.",

Loading…
Cancel
Save