From c81039724d2f37de5ad5534ca5fb2446c7ec39e0 Mon Sep 17 00:00:00 2001 From: Carifio24 Date: Sat, 9 Mar 2024 03:05:38 -0500 Subject: [PATCH 01/55] Add method for getting location values from Mapbox using search text. --- src/SolarEclipse2024.vue | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/SolarEclipse2024.vue b/src/SolarEclipse2024.vue index a5a3e24b..6aa706ae 100644 --- a/src/SolarEclipse2024.vue +++ b/src/SolarEclipse2024.vue @@ -1403,6 +1403,7 @@ export interface MapBoxFeature { text: string; // eslint-disable-next-line @typescript-eslint/naming-convention properties: { short_code: string; }; + center?: [number, number]; } export interface MapBoxFeatureCollection { @@ -3267,6 +3268,22 @@ export default defineComponent({ return `${lat}° ${ns}, ${lon}° ${ew}`; } }, + + async locationForText(searchText: string): Promise<[number, number] | null> { + const accessToken = process.env.VUE_APP_MAPBOX_ACCESS_TOKEN; + const url = `https://api.mapbox.com/geocoding/v5/mapbox.places/${searchText}.json?access_token=${accessToken}`; + const mapBoxLocation = await fetch(url) + .then(response => response.json()) + .then((result: MapBoxFeatureCollection) => { + if (result.features.length === 0) { + return null; + } + return result.features[0].center ?? null; + }) + .catch((_err) => null); + + return mapBoxLocation; + }, decreasePlaybackRate() { this.forceRate = false; From db5c16342e40e4604fead48dcdcc8a6178f10156 Mon Sep 17 00:00:00 2001 From: Carifio24 Date: Sun, 10 Mar 2024 13:07:54 -0400 Subject: [PATCH 02/55] Get text along with location when forward geocoding. --- src/SolarEclipse2024.vue | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/SolarEclipse2024.vue b/src/SolarEclipse2024.vue index 6aa706ae..69925f70 100644 --- a/src/SolarEclipse2024.vue +++ b/src/SolarEclipse2024.vue @@ -1411,6 +1411,11 @@ export interface MapBoxFeatureCollection { features: MapBoxFeature[]; } +export interface ForwardGeocodingInfo { + location: [number, number]; + text: string; +} + // number of milliseconds since January 1, 1970, 00:00:00 UTC // month is indexed from 0..?! @@ -3269,20 +3274,24 @@ export default defineComponent({ } }, - async locationForText(searchText: string): Promise<[number, number] | null> { + async geocodingInfoForSearch(searchText: string): Promise { const accessToken = process.env.VUE_APP_MAPBOX_ACCESS_TOKEN; const url = `https://api.mapbox.com/geocoding/v5/mapbox.places/${searchText}.json?access_token=${accessToken}`; - const mapBoxLocation = await fetch(url) + const geocodingInfo = await fetch(url) .then(response => response.json()) .then((result: MapBoxFeatureCollection) => { - if (result.features.length === 0) { + const center = result.features[0]?.center; + if (result.features.length === 0 || !center) { return null; } - return result.features[0].center ?? null; + return { + location: center, + text: this.mapboxLocationText(result) + }; }) .catch((_err) => null); - return mapBoxLocation; + return geocodingInfo; }, decreasePlaybackRate() { From b5f420def63f0087e18ed8f1abe3d663666cd4ca Mon Sep 17 00:00:00 2001 From: Carifio24 Date: Mon, 11 Mar 2024 00:33:10 -0400 Subject: [PATCH 03/55] Update selected text in map update rather than in watcher. --- src/SolarEclipse2024.vue | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/SolarEclipse2024.vue b/src/SolarEclipse2024.vue index 69925f70..86d82e70 100644 --- a/src/SolarEclipse2024.vue +++ b/src/SolarEclipse2024.vue @@ -2708,6 +2708,9 @@ export default defineComponent({ return; } this.locationDeg = location; + this.textForLocation(this.locationDeg.longitudeDeg, this.locationDeg.latitudeDeg).then((text) => { + this.selectedLocationText = text; + }); }, onTimeSliderChange() { @@ -3320,11 +3323,18 @@ export default defineComponent({ this.playbackRate = sign * Math.pow(10, Math.abs(ezrate)); }, - - async updateSelectedLocationText() { this.selectedLocationText = await this.textForLocation(this.locationDeg.longitudeDeg, this.locationDeg.latitudeDeg); }, + + async updateFromForwardGeocoding(searchText: string) { + const info = await this.geocodingInfoForSearch(searchText); + if (info === null) { + return; + } + this.locationDeg = { latitudeDeg: info.location[0], longitudeDeg: info.location[1] }; + this.selectedLocationText = info.text; + }, niceRound(val: number) { // rounding routine specifically for the playback rate @@ -3458,7 +3468,6 @@ export default defineComponent({ this.playing = false; // this.sunOffset = null; this.updateWWTLocation(); - this.updateSelectedLocationText(); // We need to let the location update before we redraw the horizon and overlay // Not a huge fan of having to do this, but we really need a frame render to update e.g. sun/moon positions From dee1ab0ef23cafd8e092c7750bb06ae4f1513764 Mon Sep 17 00:00:00 2001 From: Carifio24 Date: Mon, 11 Mar 2024 13:54:07 -0400 Subject: [PATCH 04/55] Start working on UI for search text. --- src/SolarEclipse2024.vue | 20 ++++++++++++++++++++ src/main.ts | 4 ++++ 2 files changed, 24 insertions(+) diff --git a/src/SolarEclipse2024.vue b/src/SolarEclipse2024.vue index 86d82e70..5df88f03 100644 --- a/src/SolarEclipse2024.vue +++ b/src/SolarEclipse2024.vue @@ -659,6 +659,24 @@ }" faSize="1x" > +
+ + +
Date: Mon, 11 Mar 2024 18:05:01 -0400 Subject: [PATCH 05/55] Make custom component for forward geocoding search. --- src/ForwardGeocodingInput.vue | 182 ++++++++++++++++++++++++++++++++++ src/SolarEclipse2024.vue | 40 ++++---- src/main.ts | 2 + 3 files changed, 205 insertions(+), 19 deletions(-) create mode 100644 src/ForwardGeocodingInput.vue diff --git a/src/ForwardGeocodingInput.vue b/src/ForwardGeocodingInput.vue new file mode 100644 index 00000000..17449880 --- /dev/null +++ b/src/ForwardGeocodingInput.vue @@ -0,0 +1,182 @@ + + + + + diff --git a/src/SolarEclipse2024.vue b/src/SolarEclipse2024.vue index 5df88f03..76c497bf 100644 --- a/src/SolarEclipse2024.vue +++ b/src/SolarEclipse2024.vue @@ -659,24 +659,11 @@ }" faSize="1x" > -
- - -
+
{ + console.log(info); + if (info === null) { return; } + this.locationDeg = { longitudeDeg: info.location[0], latitudeDeg: info.location[1] }; + this.selectedLocationText = info.text; + }); + }, decreasePlaybackRate() { this.forceRate = false; @@ -3830,6 +3827,7 @@ body { display: flex; flex-direction: column; gap: 10px; + width: fit-content; @media (max-width: 599px) { top: 2.5rem; @@ -5286,4 +5284,8 @@ a { opacity: 0; } } + +.icon-wrapper { + width: fit-content; +} diff --git a/src/main.ts b/src/main.ts index dd24a851..bbd8892f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -13,6 +13,7 @@ import HoverTooltip from "./HoverTooltip.vue"; import CloudCover from "./CloudCover.vue"; import DefineTerm from "./DefineTerm.vue"; import PlaybackControl from "./PlaybackControl.vue"; +import ForwardGeocodingInput from "./ForwardGeocodingInput.vue"; import "./polyfills"; @@ -147,5 +148,6 @@ createApp(SolarEclipse2023, { .component('cloud-cover', CloudCover) .component('define-term', DefineTerm) .component('playback-control', PlaybackControl) + .component('forward-geocoding-input', ForwardGeocodingInput) // Mount .mount("#app"); From 88d73fcf7ccd00343fdb3150b517d4abb8faf089 Mon Sep 17 00:00:00 2001 From: Carifio24 Date: Tue, 12 Mar 2024 15:52:26 -0400 Subject: [PATCH 06/55] Trim down forward geocoding component based on new layout idea. --- src/ForwardGeocodingInput.vue | 116 ++++++---------------------------- src/main.ts | 2 - 2 files changed, 19 insertions(+), 99 deletions(-) diff --git a/src/ForwardGeocodingInput.vue b/src/ForwardGeocodingInput.vue index 17449880..bb9ecebe 100644 --- a/src/ForwardGeocodingInput.vue +++ b/src/ForwardGeocodingInput.vue @@ -1,119 +1,45 @@ - - diff --git a/src/SolarEclipse2024.vue b/src/SolarEclipse2024.vue index 76c497bf..045ea55e 100644 --- a/src/SolarEclipse2024.vue +++ b/src/SolarEclipse2024.vue @@ -625,6 +625,26 @@ >
+
+ + +
-
From 6d198ce8937158d34c78e9ca990bfd22c115f194 Mon Sep 17 00:00:00 2001 From: Carifio24 Date: Tue, 12 Mar 2024 16:51:43 -0400 Subject: [PATCH 08/55] Selecting a location from the search results is functional. Need to clean up the display. --- src/SolarEclipse2024.vue | 56 +++++++++++++++++++--------------------- src/main.ts | 2 -- 2 files changed, 27 insertions(+), 31 deletions(-) diff --git a/src/SolarEclipse2024.vue b/src/SolarEclipse2024.vue index 045ea55e..b16ea7b7 100644 --- a/src/SolarEclipse2024.vue +++ b/src/SolarEclipse2024.vue @@ -640,10 +640,21 @@ size="lg" @click="() => { if (searchText !== null && searchText.length > 0) { - updateFromSearchText(searchText); + forwardGeocodingSearch(searchText); } }" > +
+
+ {{ feature.place_name }} +
+
{ + async geocodingInfoForSearch(searchText: string): Promise { const accessToken = process.env.VUE_APP_MAPBOX_ACCESS_TOKEN; const url = `https://api.mapbox.com/geocoding/v5/mapbox.places/${searchText}.json?access_token=${accessToken}`; - const geocodingInfo = await fetch(url) + return fetch(url) .then(response => response.json()) .then((result: MapBoxFeatureCollection) => { - const center = result.features[0]?.center; - if (result.features.length === 0 || !center) { - return null; - } - console.log(result); - console.log(this.mapboxLocationText(result)); - return { - location: center, - text: this.mapboxLocationText(result) - }; + return result; }) .catch((_err) => null); - - return geocodingInfo; }, - updateFromSearchText(searchText: string) { + forwardGeocodingSearch(searchText: string) { this.geocodingInfoForSearch(searchText).then((info) => { console.log(info); - if (info === null) { return; } - this.locationDeg = { longitudeDeg: info.location[0], latitudeDeg: info.location[1] }; - this.selectedLocationText = info.text; + this.searchResults = info; }); }, @@ -3359,15 +3360,6 @@ export default defineComponent({ this.selectedLocationText = await this.textForLocation(this.locationDeg.longitudeDeg, this.locationDeg.latitudeDeg); }, - async updateFromForwardGeocoding(searchText: string) { - const info = await this.geocodingInfoForSearch(searchText); - if (info === null) { - return; - } - this.locationDeg = { latitudeDeg: info.location[0], longitudeDeg: info.location[1] }; - this.selectedLocationText = info.text; - }, - niceRound(val: number) { // rounding routine specifically for the playback rate const abs = Math.abs(val); @@ -5305,16 +5297,22 @@ a { } #forward-geocoding-container { + position: relative; display: flex; flex-direction: row; justify-content: space-around; gap: 10px; padding: 0px 10px; align-items: center; + justify-content: center; width: fit-content; color: var(--accent-color); background-color: black; border: 1px solid var(--accent-color); border-radius: 10px; + + .v-text-field { + width: 250px; + } } diff --git a/src/main.ts b/src/main.ts index 377b5b42..3e9cdce5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -13,7 +13,6 @@ import HoverTooltip from "./HoverTooltip.vue"; import CloudCover from "./CloudCover.vue"; import DefineTerm from "./DefineTerm.vue"; import PlaybackControl from "./PlaybackControl.vue"; -import ForwardGeocodingInput from "./ForwardGeocodingInput.vue"; import "./polyfills"; @@ -146,6 +145,5 @@ createApp(SolarEclipse2023, { .component('cloud-cover', CloudCover) .component('define-term', DefineTerm) .component('playback-control', PlaybackControl) - .component('forward-geocoding-input', ForwardGeocodingInput) // Mount .mount("#app"); From b3a13ca7383e6b8092d37d2ea671ea0a98c89cae Mon Sep 17 00:00:00 2001 From: Carifio24 Date: Tue, 12 Mar 2024 17:16:09 -0400 Subject: [PATCH 09/55] Set up UI for search results and do some minor refactoring. --- src/SolarEclipse2024.vue | 113 +++++++++++++++++++++++++++------------ 1 file changed, 80 insertions(+), 33 deletions(-) diff --git a/src/SolarEclipse2024.vue b/src/SolarEclipse2024.vue index b16ea7b7..50adc78e 100644 --- a/src/SolarEclipse2024.vue +++ b/src/SolarEclipse2024.vue @@ -628,31 +628,34 @@
- -
+ +
- {{ feature.place_name }} +
+ {{ feature.place_name }} +
@@ -3314,7 +3317,7 @@ export default defineComponent({ async geocodingInfoForSearch(searchText: string): Promise { const accessToken = process.env.VUE_APP_MAPBOX_ACCESS_TOKEN; - const url = `https://api.mapbox.com/geocoding/v5/mapbox.places/${searchText}.json?access_token=${accessToken}`; + const url = `https://api.mapbox.com/geocoding/v5/mapbox.places/${searchText}.json?access_token=${accessToken}&types=place`; return fetch(url) .then(response => response.json()) .then((result: MapBoxFeatureCollection) => { @@ -3323,12 +3326,32 @@ export default defineComponent({ .catch((_err) => null); }, - forwardGeocodingSearch(searchText: string) { - this.geocodingInfoForSearch(searchText).then((info) => { - console.log(info); - this.searchResults = info; + performForwardGeocodingSearch() { + if (this.searchText === null || this.searchText.length === 0) { + return; + } + this.geocodingInfoForSearch(this.searchText).then((info) => { + if (info !== null && info.features?.length === 1) { + this.setLocationFromSearchFeature(info.features[0]); + } else { + this.searchResults = info; + } }); }, + + setLocationFromFeature(feature: MapBoxFeature) { + this.locationDeg = { longitudeDeg: feature.center[0], latitudeDeg: feature.center[1] }; + }, + + clearSearchData() { + this.searchResults = null; + this.searchText = null; + }, + + setLocationFromSearchFeature(feature: MapBoxFeature) { + this.setLocationFromFeature(feature); + this.clearSearchData(); + }, decreasePlaybackRate() { this.forceRate = false; @@ -5298,13 +5321,6 @@ a { #forward-geocoding-container { position: relative; - display: flex; - flex-direction: row; - justify-content: space-around; - gap: 10px; - padding: 0px 10px; - align-items: center; - justify-content: center; width: fit-content; color: var(--accent-color); background-color: black; @@ -5313,6 +5329,37 @@ a { .v-text-field { width: 250px; + height: 75px; + } + + #forward-geocoding-input-row { + display: flex; + flex-direction: row; + gap: 10px; + padding: 0px 10px; + align-items: center; + } + + #forward-geocoding-results { + position: absolute; + top: 75px; + left: 0; + width: 100%; + background: black; + border: 1px solid var(--accent-color); + border-radius: 10px; + padding: 0px 10px; + + .forward-geocoding-result { + border-bottom: 1px solid var(--accent-color); + border-top: 1px solid var(--accent-color); + font-size: 10pt; + pointer-events: auto; + + &:hover { + cursor: pointer; + } + } } } From 525cf21b747bc098e62c352c9a143b812d54ba47 Mon Sep 17 00:00:00 2001 From: Carifio24 Date: Tue, 12 Mar 2024 17:57:30 -0400 Subject: [PATCH 10/55] More adjustments to the forward geocoding UI. --- src/SolarEclipse2024.vue | 59 +++++++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 19 deletions(-) diff --git a/src/SolarEclipse2024.vue b/src/SolarEclipse2024.vue index 50adc78e..03f7459e 100644 --- a/src/SolarEclipse2024.vue +++ b/src/SolarEclipse2024.vue @@ -635,27 +635,29 @@ v-model="searchText" class="forward-geocoding-input" label="Enter a location" - :color="accentColor" bg-color="black" + :color="accentColor" @keyup.enter="() => performForwardGeocodingSearch()" + :error-messages="searchErrorMessage" > +
+
-
- {{ feature.place_name }} -
+ {{ feature.place_name }}
@@ -1687,6 +1689,8 @@ export default defineComponent({ searchText: null as string | null, searchResults: null as MapBoxFeatureCollection | null, + searchErrorMessage: null as string | null, + showMapTooltip: false, showTextTooltip: false, showMapSelector: false, @@ -3303,7 +3307,9 @@ export default defineComponent({ } return this.mapboxLocationText(result); }) - .catch((_err) => null); + .catch((_err) => { + this.searchErrorMessage = "An error occurred while searching"; + }); if (mapBoxText) { return mapBoxText; } else { @@ -3327,12 +3333,15 @@ export default defineComponent({ }, performForwardGeocodingSearch() { - if (this.searchText === null || this.searchText.length === 0) { + if (this.searchText === null || this.searchText.length < 3) { return; } this.geocodingInfoForSearch(this.searchText).then((info) => { + console.log(info); if (info !== null && info.features?.length === 1) { this.setLocationFromSearchFeature(info.features[0]); + } else if (info !== null && info.features?.length == 0) { + this.searchErrorMessage = "No matching places were found"; } else { this.searchResults = info; } @@ -3346,6 +3355,7 @@ export default defineComponent({ clearSearchData() { this.searchResults = null; this.searchText = null; + this.searchErrorMessage = null; }, setLocationFromSearchFeature(feature: MapBoxFeature) { @@ -3539,6 +3549,12 @@ export default defineComponent({ } }, + searchText(_text: string | null) { + if (this.searchErrorMessage) { + this.searchErrorMessage = null; + } + }, + playing(play: boolean) { console.log(`${play ? 'Playing:' : 'Stopping:'} at ${this.playbackRate}x real time`); this.setClockSync(play); @@ -5329,7 +5345,7 @@ a { .v-text-field { width: 250px; - height: 75px; + height: 80px; } #forward-geocoding-input-row { @@ -5340,20 +5356,25 @@ a { align-items: center; } + // For some reason setting width: 100% makes the search results 2px too small + // It's probably some Vuetify styling thing + // Maybe there's a better workaround, but this gets the job done for now #forward-geocoding-results { position: absolute; - top: 75px; - left: 0; - width: 100%; + top: 70px; + left: -1px; + width: calc(100% + 2px); background: black; border: 1px solid var(--accent-color); - border-radius: 10px; + border-top: 0px; + border-bottom-left-radius: 10px; + border-bottom-right-radius: 10px; padding: 0px 10px; .forward-geocoding-result { border-bottom: 1px solid var(--accent-color); border-top: 1px solid var(--accent-color); - font-size: 10pt; + font-size: 12pt; pointer-events: auto; &:hover { From bdeeee0731be6408c2639b865cb19697aee32d7a Mon Sep 17 00:00:00 2001 From: Carifio24 Date: Wed, 13 Mar 2024 11:15:50 -0400 Subject: [PATCH 11/55] Use a single text-creation algorithm for both forward and backward geocoding. --- src/SolarEclipse2024.vue | 88 ++++++++++++++++++++++++++-------------- 1 file changed, 58 insertions(+), 30 deletions(-) diff --git a/src/SolarEclipse2024.vue b/src/SolarEclipse2024.vue index 03f7459e..3de0b898 100644 --- a/src/SolarEclipse2024.vue +++ b/src/SolarEclipse2024.vue @@ -638,6 +638,7 @@ bg-color="black" :color="accentColor" @keyup.enter="() => performForwardGeocodingSearch()" + @blur="searchResults = null" :error-messages="searchErrorMessage" > { - this.selectedLocationText = text; - }); }, onTimeSliderChange() { @@ -3264,38 +3268,61 @@ export default defineComponent({ } }, - - mapboxLocationText(location: MapBoxFeatureCollection): string { - const relevantFeatures = location.features.filter(feature => RELEVANT_FEATURE_TYPES.some(type => feature.place_type.includes(type))); - const placeFeature = relevantFeatures.find(feature => feature.place_type.includes("place")) ?? (relevantFeatures.find(feature => feature.place_type.includes("postcode")) ?? null); - const pieces: string[] = []; - if (placeFeature && placeFeature.text) { - pieces.push(placeFeature.text); + findBestFeature(collection: MapBoxFeatureCollection): MapBoxFeature | null { + const relevantFeatures = collection.features.filter(feature => RELEVANT_FEATURE_TYPES.some(type => feature.place_type.includes(type))); + const placeFeature = relevantFeatures.find(feature => feature.place_type.includes("place")) ?? (relevantFeatures.find(feature => feature.place_type.includes("postcode")) ?? undefined); + if (placeFeature !== undefined) { + return placeFeature; + } + const regionFeature = relevantFeatures.find(feature => feature.place_type.includes("region")); + if (regionFeature !== undefined) { + return regionFeature; } const countryFeature = relevantFeatures.find(feature => feature.place_type.includes("country")); - if (countryFeature) { - let countryText: string | null = countryFeature.text; - if (NA_COUNTRIES.includes(countryText)) { - countryText = null; - const regionFeature = relevantFeatures.find(feature => feature.place_type.includes("region")); - if (regionFeature) { - let stateCode = regionFeature.properties.short_code as string; - if (stateCode) { - if (NA_ABBREVIATIONS.some(abbr => stateCode.startsWith(abbr))) { - stateCode = stateCode.substring(3); - } - pieces.push(stateCode); - } + if (countryFeature !== undefined) { + return countryFeature; + } + return null; + }, + + textForMapboxFeature(feature: MapBoxFeature): string { + const pieces: string[] = []; + if (feature.text) { + pieces.push(feature.text); + } + feature.context.forEach(item => { + const itemType = item.id.split(".")[0]; + if (!RELEVANT_FEATURE_TYPES.includes(itemType)) { + return; + } + let text = null as string | null; + const shortCode = item.short_code; + if (itemType === "region" && shortCode != null) { + if (NA_ABBREVIATIONS.some(abbr => shortCode.startsWith(abbr))) { + text = shortCode.substring(3); + } + } else if (itemType === "country") { + const itemText = item.text; + if (!NA_COUNTRIES.includes(itemText)) { + text = itemText; } } - if (countryText) { - pieces.push(countryText); + if (text !== null) { + pieces.push(text); } - } + }); return pieces.join(", "); }, + textForMapboxResults(results: MapBoxFeatureCollection): string { + const feature = this.findBestFeature(results); + if (feature === null) { + return ""; + } + return this.textForMapboxFeature(feature); + }, + async textForLocation(longitudeDeg: number, latitudeDeg: number): Promise { const accessToken = process.env.VUE_APP_MAPBOX_ACCESS_TOKEN; const url = `https://api.mapbox.com/geocoding/v5/mapbox.places/${longitudeDeg},${latitudeDeg}.json?access_token=${accessToken}`; @@ -3305,7 +3332,7 @@ export default defineComponent({ if (result.features.length === 0) { return null; } - return this.mapboxLocationText(result); + return this.textForMapboxResults(result); }) .catch((_err) => { this.searchErrorMessage = "An error occurred while searching"; @@ -3525,6 +3552,7 @@ export default defineComponent({ this.playing = false; // this.sunOffset = null; this.updateWWTLocation(); + this.updateSelectedLocationText(); // We need to let the location update before we redraw the horizon and overlay // Not a huge fan of having to do this, but we really need a frame render to update e.g. sun/moon positions From 540945d992735389bb37983028bfedbba6ab03f2 Mon Sep 17 00:00:00 2001 From: Carifio24 Date: Wed, 13 Mar 2024 11:52:34 -0400 Subject: [PATCH 12/55] Some more tweaking of the forward geocoding functionality. --- src/SolarEclipse2024.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SolarEclipse2024.vue b/src/SolarEclipse2024.vue index 3de0b898..b1af3fc7 100644 --- a/src/SolarEclipse2024.vue +++ b/src/SolarEclipse2024.vue @@ -638,7 +638,6 @@ bg-color="black" :color="accentColor" @keyup.enter="() => performForwardGeocodingSearch()" - @blur="searchResults = null" :error-messages="searchErrorMessage" > { - console.log(info); if (info !== null && info.features?.length === 1) { this.setLocationFromSearchFeature(info.features[0]); } else if (info !== null && info.features?.length == 0) { @@ -3377,6 +3376,9 @@ export default defineComponent({ setLocationFromFeature(feature: MapBoxFeature) { this.locationDeg = { longitudeDeg: feature.center[0], latitudeDeg: feature.center[1] }; + this.textForLocation(feature.center[0], feature.center[1]).then((text) => { + this.selectedLocationText = text; + }); }, clearSearchData() { @@ -3552,7 +3554,6 @@ export default defineComponent({ this.playing = false; // this.sunOffset = null; this.updateWWTLocation(); - this.updateSelectedLocationText(); // We need to let the location update before we redraw the horizon and overlay // Not a huge fan of having to do this, but we really need a frame render to update e.g. sun/moon positions @@ -5400,7 +5401,6 @@ a { padding: 0px 10px; .forward-geocoding-result { - border-bottom: 1px solid var(--accent-color); border-top: 1px solid var(--accent-color); font-size: 12pt; pointer-events: auto; From 7523495bee08ca33f9e46ab1c7425f2dccf9ed6e Mon Sep 17 00:00:00 2001 From: John Arban Lewis Date: Mon, 11 Mar 2024 19:58:07 -0400 Subject: [PATCH 13/55] improve css and HTML outline. presentable on mobile --- src/AdvancedWeatherView.vue | 382 +++++++++++++++++++----------------- 1 file changed, 197 insertions(+), 185 deletions(-) diff --git a/src/AdvancedWeatherView.vue b/src/AdvancedWeatherView.vue index ce66dbe6..87c9d0f4 100644 --- a/src/AdvancedWeatherView.vue +++ b/src/AdvancedWeatherView.vue @@ -6,9 +6,9 @@ > -

Just how cloudy is it in {{ locationName }} in April? +

Just how cloudy is it in {{ locationName }} in April? - - - + + + - - - - - - + + + {{ displayData ? (needToUpdate ? 'Update Map' : 'Shown on Map') : 'Show on Map' }} + @click="updateData()" + > + {{ displayData ? (needToUpdate ? 'Update Map' : 'Shown on Map') : 'Show on Map' }} + + - - - + + - +
-

Show cloud cover statistics for currently selected location: {{ locationName }}

+

Show cloud cover statistics for currently selected location: {{ locationName }}

Show details -
- - -
-
- -

Cloud Cover for {{ locationName }} for {{ mapSubsets.get(dataSubset) }}:

-

Cloud Cover for {{ locationName }} in {{ selectedYear }}:

- - -
-
-

Cloud Cover for {{ locationName }} for all years:

- - - - -
-
- - - + + {{ mapDescriptionText }}
-
+ +
+ + + +
+
+ +

Cloud Cover for {{ mapSubsets.get(dataSubset) }}:

+

Cloud Cover for {{ locationName }} in {{ selectedYear }}:

+ + +
+
+

Cloud Cover for all years:

+ + + + +
- + - + - + :y-axis-options="{ + ticks: {callback: (value: number, index: number) => { + if (value < 0 || value > 1) {return;} + return (value * 100).toFixed(0) + '%'; + }}}" + timeseries + color="grey" + show-scatter + :annotations="[...skyCoverCodeRanges.map(([_,[min,max]],i) => { + return { + type: 'box', + yMin: min/100, + yMax: max/100, + backgroundColor: colorMap[i], + drawTime: 'beforeDraw', + borderColor: colorMap[i] + } + }), + ...skyCoverCodeRanges.map(([label,[min,max]],i) => { + return { + type: 'line', + borderWidth: 0, + drawTime: 'beforeDatasetsDraw', + + label: { + display: true, + color: 'black', + backgroundColor: 'transparent', + content: skyCoverCodes[i], + }, + xMin: new Date(2023, 1, 8), + yMin: (min + max) / 200, + yMax: (min + max) / 200, + }; + }) + ]" + /> @@ -501,7 +501,7 @@ export default defineComponent({ mapDescriptionText: '', locationName: '', inBounds: false, - displayData: false, + displayData: true, displayCharts: false, showCloudCover: true, transferFunction: this.transferFunction8, @@ -1211,6 +1211,11 @@ export default defineComponent({ #advanced-weather-view { --color: #eac402; font-size: var(--default-font-size); + --smaller-font: calc(0.8 * var(--default-font-size)); + + h1 { + font-size: 1.5em; + } p.intro { font-size: 1em; @@ -1218,17 +1223,24 @@ export default defineComponent({ strong.attention { font-weight: bold; - font-size: 1em; color: var(--color); } - #chart-intro { - - } .graph-col { height: 300px; } + + .v-btn { + font-size: var(--smaller-font); + } + + .modis-radio { + margin-top: 0.125em; + } + .v-label { + font-size: var(--smaller-font); + } #awv-map-description { font-size: 1em; @@ -1254,7 +1266,7 @@ export default defineComponent({ font-size: 1.125em; - > * { + >label, >select { margin: 0.25em auto; } From 09d9686975d879e3eced7794d7377e655da1653d Mon Sep 17 00:00:00 2001 From: John Arban Lewis Date: Mon, 11 Mar 2024 20:03:20 -0400 Subject: [PATCH 14/55] remove show map checkbox and give larger map --- src/AdvancedWeatherView.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AdvancedWeatherView.vue b/src/AdvancedWeatherView.vue index 87c9d0f4..2272643e 100644 --- a/src/AdvancedWeatherView.vue +++ b/src/AdvancedWeatherView.vue @@ -135,7 +135,7 @@ :cmap="(x: number) => [`hsla(0,0%,100%, 1)`, transferFunction(x)]" /> -
+
Date: Mon, 11 Mar 2024 20:09:51 -0400 Subject: [PATCH 15/55] minor fixes --- src/AdvancedWeatherView.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AdvancedWeatherView.vue b/src/AdvancedWeatherView.vue index 2272643e..18c9d692 100644 --- a/src/AdvancedWeatherView.vue +++ b/src/AdvancedWeatherView.vue @@ -501,7 +501,7 @@ export default defineComponent({ mapDescriptionText: '', locationName: '', inBounds: false, - displayData: true, + displayData: false, displayCharts: false, showCloudCover: true, transferFunction: this.transferFunction8, From 95a369112bb57b97099bc6635938838193474a31 Mon Sep 17 00:00:00 2001 From: Carifio24 Date: Wed, 13 Mar 2024 12:02:46 -0400 Subject: [PATCH 16/55] Make location input box smaller. --- src/SolarEclipse2024.vue | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/SolarEclipse2024.vue b/src/SolarEclipse2024.vue index b1af3fc7..b9da5dfb 100644 --- a/src/SolarEclipse2024.vue +++ b/src/SolarEclipse2024.vue @@ -111,6 +111,7 @@ class="mr-2 mb-2" v-if="infoPage==1" density="compact" + hide-details :color="accentColor" @click="infoPage++" @keyup.enter="infoPage++" @@ -636,8 +637,12 @@ class="forward-geocoding-input" label="Enter a location" bg-color="black" + density="compact" + hide-details + clearable :color="accentColor" @keyup.enter="() => performForwardGeocodingSearch()" + @keyup.esc="searchResults = null" :error-messages="searchErrorMessage" > Date: Wed, 13 Mar 2024 12:04:02 -0400 Subject: [PATCH 17/55] Clear search results when input is cleared. --- src/SolarEclipse2024.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SolarEclipse2024.vue b/src/SolarEclipse2024.vue index b9da5dfb..25e96774 100644 --- a/src/SolarEclipse2024.vue +++ b/src/SolarEclipse2024.vue @@ -643,6 +643,7 @@ :color="accentColor" @keyup.enter="() => performForwardGeocodingSearch()" @keyup.esc="searchResults = null" + @click:clear="searchResults = null" :error-messages="searchErrorMessage" > Date: Wed, 13 Mar 2024 12:05:31 -0400 Subject: [PATCH 18/55] Also clear search results when input is empty. --- src/SolarEclipse2024.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/SolarEclipse2024.vue b/src/SolarEclipse2024.vue index 25e96774..fbae8969 100644 --- a/src/SolarEclipse2024.vue +++ b/src/SolarEclipse2024.vue @@ -3584,10 +3584,13 @@ export default defineComponent({ } }, - searchText(_text: string | null) { + searchText(text: string | null) { if (this.searchErrorMessage) { this.searchErrorMessage = null; } + if (!text || text.length === 0) { + this.searchResults = null; + } }, playing(play: boolean) { From 0985b929a91c822ec3fe52c799dbec96b4a30217 Mon Sep 17 00:00:00 2001 From: Pat Udomprasert Date: Wed, 13 Mar 2024 12:47:32 -0400 Subject: [PATCH 19/55] Announce location search on splash screen --- src/SolarEclipse2024.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/SolarEclipse2024.vue b/src/SolarEclipse2024.vue index fbae8969..e253c6b7 100644 --- a/src/SolarEclipse2024.vue +++ b/src/SolarEclipse2024.vue @@ -809,6 +809,10 @@
+ + + New! Location Search + Date: Wed, 13 Mar 2024 13:52:47 -0400 Subject: [PATCH 20/55] Make search box collapsible. Open by default on desktop but not mobile. --- src/SolarEclipse2024.vue | 54 ++++++++++++++++++++++++++++++++++------ src/main.ts | 3 ++- 2 files changed, 48 insertions(+), 9 deletions(-) diff --git a/src/SolarEclipse2024.vue b/src/SolarEclipse2024.vue index e253c6b7..8013e9d4 100644 --- a/src/SolarEclipse2024.vue +++ b/src/SolarEclipse2024.vue @@ -628,11 +628,13 @@
+
Date: Wed, 13 Mar 2024 14:34:36 -0400 Subject: [PATCH 21/55] Remove search field clear button and make search field open by default on mobile. --- src/SolarEclipse2024.vue | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/SolarEclipse2024.vue b/src/SolarEclipse2024.vue index 8013e9d4..f509815c 100644 --- a/src/SolarEclipse2024.vue +++ b/src/SolarEclipse2024.vue @@ -641,7 +641,6 @@ bg-color="black" density="compact" hide-details - clearable variant="solo" :color="accentColor" @keydown.stop @@ -1724,7 +1723,7 @@ export default defineComponent({ positionSet: false, imagesetFolder: null as Folder | null, - searchOpen: false, + searchOpen: true, searchText: null as string | null, searchResults: null as MapBoxFeatureCollection | null, searchErrorMessage: null as string | null, @@ -1894,10 +1893,6 @@ export default defineComponent({ queryData.splash = splashQuery !== "false"; }, - created() { - this.searchOpen = !this.mobile; - }, - mounted() { if (queryData.latitudeDeg !== undefined && queryData.longitudeDeg !== undefined) { From 9d6bff6c13adaba34228c5bac6cd67870fcacdbb Mon Sep 17 00:00:00 2001 From: Carifio24 Date: Wed, 13 Mar 2024 15:50:55 -0400 Subject: [PATCH 22/55] Modify icons and positioning of forward geocoding icons. --- src/SolarEclipse2024.vue | 31 ++++++++++++++++++------------- src/main.ts | 4 ++-- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/SolarEclipse2024.vue b/src/SolarEclipse2024.vue index f509815c..3c71a516 100644 --- a/src/SolarEclipse2024.vue +++ b/src/SolarEclipse2024.vue @@ -650,18 +650,8 @@ :error-messages="searchErrorMessage" > - +
Date: Wed, 13 Mar 2024 17:43:15 -0400 Subject: [PATCH 23/55] improve mobile layout --- src/AdvancedWeatherView.vue | 99 +++++++++++++++++++------------------ src/main.ts | 2 +- 2 files changed, 51 insertions(+), 50 deletions(-) diff --git a/src/AdvancedWeatherView.vue b/src/AdvancedWeatherView.vue index 18c9d692..20f36bc9 100644 --- a/src/AdvancedWeatherView.vue +++ b/src/AdvancedWeatherView.vue @@ -23,9 +23,9 @@

- - - + + + @@ -69,15 +69,16 @@ {{ displayData ? (needToUpdate ? 'Update Map' : 'Shown on Map') : 'Show on Map' }} - + Show details + + +
+
+ +

Cloud Cover for {{ mapSubsets.get(dataSubset) }}:

+

Cloud Cover for {{ locationName }} in {{ selectedYear }}:

+ + +
+
+

Cloud Cover for all years:

+ + + + +
+
- - + + {{ mapDescriptionText }}
-
+
- - - -
-
- -

Cloud Cover for {{ mapSubsets.get(dataSubset) }}:

-

Cloud Cover for {{ locationName }} in {{ selectedYear }}:

- - -
-
-

Cloud Cover for all years:

- - - - -
-
@@ -501,8 +501,8 @@ export default defineComponent({ mapDescriptionText: '', locationName: '', inBounds: false, - displayData: false, - displayCharts: false, + displayData: true, + displayCharts: true, showCloudCover: true, transferFunction: this.transferFunction8, }; @@ -1210,6 +1210,7 @@ export default defineComponent({ #advanced-weather-view { --color: #eac402; + --default-font-size: clamp(0.7rem, min(1.7vh, 1.7vw), 1.1rem); font-size: var(--default-font-size); --smaller-font: calc(0.8 * var(--default-font-size)); diff --git a/src/main.ts b/src/main.ts index 70941e21..b57b273f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -101,7 +101,7 @@ library.add(faAnglesRight); // Extract the function out, up here, so I'm not writing it twice const update = (el: HTMLElement, binding: Vue.DirectiveBinding) => el.style.visibility = (binding.value) ? "hidden" : ""; -createApp(SolarEclipse2023, { +createApp(AdvancedWeatherView, { wwtNamespace: "wwt-minids-solar-eclipse-2024", // wtml: { // use this just as a test for the sun // eclipse: "https://raw.githubusercontent.com/patudom/star-life-cycle/master/content/BUACStellarLifeCycles.wtml", From 5359058c795b266d790e6e08d1ff8b829e22ea55 Mon Sep 17 00:00:00 2001 From: John Arban Lewis Date: Wed, 13 Mar 2024 19:18:24 -0400 Subject: [PATCH 24/55] make display more responsive on in between sizes --- src/AdvancedWeatherView.vue | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/AdvancedWeatherView.vue b/src/AdvancedWeatherView.vue index 20f36bc9..0840f130 100644 --- a/src/AdvancedWeatherView.vue +++ b/src/AdvancedWeatherView.vue @@ -25,10 +25,10 @@ - + - - + + - + the Median - +