From 95fe5609ac07a5fa8267e43a03ef7def293c0562 Mon Sep 17 00:00:00 2001 From: Amandus Butzer Date: Thu, 22 Aug 2024 14:30:37 +0200 Subject: [PATCH 1/7] fix: steepness coloring & description --- .../components/extras/route-extras.js | 2 +- src/fragments/map-view/map-view.js | 2 +- src/resources/ors-dictionary.js | 47 +++++++++---------- 3 files changed, 25 insertions(+), 26 deletions(-) diff --git a/src/fragments/forms/map-form/components/place-and-directions/components/route-details/components/extras/route-extras.js b/src/fragments/forms/map-form/components/place-and-directions/components/route-details/components/extras/route-extras.js index 5b85a975c..db0aac3a7 100644 --- a/src/fragments/forms/map-form/components/place-and-directions/components/route-details/components/extras/route-extras.js +++ b/src/fragments/forms/map-form/components/place-and-directions/components/route-details/components/extras/route-extras.js @@ -77,7 +77,7 @@ export default { colorValue (extraKey, index, value = null) { let dict = orsDictionary let color - if (value) { + if (value !== null) { color = dict.colors[extraKey][value] } else { color = dict.colors[extraKey][index] diff --git a/src/fragments/map-view/map-view.js b/src/fragments/map-view/map-view.js index 723423352..a910270f4 100644 --- a/src/fragments/map-view/map-view.js +++ b/src/fragments/map-view/map-view.js @@ -546,7 +546,7 @@ export default { let summary = extra.summary[summaryKey] let map = { text: translations[extraDict[summary.value]] || extraDict[summary.value], - color: dict.colors[extraKey][summaryKey] + color: dict.colors[extraKey][summary.value] } mappings[extraKey][summary.value] = map } diff --git a/src/resources/ors-dictionary.js b/src/resources/ors-dictionary.js index fb29d44bb..6604f4c2b 100644 --- a/src/resources/ors-dictionary.js +++ b/src/resources/ors-dictionary.js @@ -34,17 +34,17 @@ const orsDictionary = { 'grassPaver' // at position 18 ], steepness: { - '-5': '>16%', - '-4': '12-15%', - '-3': '7-11%', - '-2': '4-6%', - '-1': '1-3%', + '-5': '↘ >16%', + '-4': '↘ 12-15%', + '-3': '↘ 7-11%', + '-2': '↘ 4-6%', + '-1': '↘ 1-3%', 0: '0%', - 1: '1-3%', - 2: '4-6%', - 3: '7-11%', - 4: '12-15%', - 5: '>16%' + 1: '↗ 1-3%', + 2: '↗ 4-6%', + 3: '↗ 7-11%', + 4: '↗ 12-15%', + 5: '↗ >16%' }, tollways: { '0': 'no_tollway', @@ -142,21 +142,20 @@ const orsDictionary = { '#228B22', // grass '#008000' // grassPaver ], - steepness: [ + steepness: { // 11 colors accessed by index - '#DDA0DD', - '#EE82EE', - '#FF00FF', - '#9400D3', - '#8B008B', - '#FFB6C1', - '#FF69B4', - '#C71585', - '#FFE4E1', - '#8B4513', - '#A52A2A', - '#800000' - ], + '-5': '#003bd1', + '-4': '#3362c5', + '-3': '#6689b9', + '-2': '#99afae', + '-1': '#ccd6a2', + 0: '#fffd96', + 1: '#f4ce78', + 2: '#e9a05a', + 3: '#dd713c', + 4: '#d2431e', + 5: '#c71400' + }, roadaccessrestrictions: { 0: 'gray', 1: 'green', From ea493bd32435d7d9019b20e1db07a6f85b01f2b2 Mon Sep 17 00:00:00 2001 From: Amandus Butzer Date: Thu, 22 Aug 2024 15:34:11 +0200 Subject: [PATCH 2/7] fix: sidebar hiding on right-click - hide sidebar on click only for low resolution as it doesn't make sense on larger screens - adjust showMapViewClickPopups to split between 'med & high' vs 'low' instead of 'high' vs 'low & med' if a right-click was done within 2 seconds after adding the first point, show click popups would still be false, due to this dubious async logic that is now removed. The logic somehow prevented to show the "What's this" modal, which without it came up when clicking an alternative route. This is prevented by stopping the propagation to the map base layer in alternativeRouteIndexSelected. --- src/fragments/map-view/map-view.js | 13 ++----------- src/pages/maps/maps.js | 2 +- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/fragments/map-view/map-view.js b/src/fragments/map-view/map-view.js index a910270f4..22520415f 100644 --- a/src/fragments/map-view/map-view.js +++ b/src/fragments/map-view/map-view.js @@ -788,6 +788,7 @@ export default { * @emits activeRouteIndexChanged */ alternativeRouteIndexSelected (index, event) { + Leaflet.DomEvent.stopPropagation(event) event.originalEvent.stopPropagation() event.originalEvent.preventDefault() EventBus.$emit('activeRouteIndexChanged', index) @@ -801,16 +802,6 @@ export default { const context = this this.$store.commit('activeRouteIndex', index) - // We just want to disable the showClickPopups - // temporarily, so we get the original state - // set it as false and after two seconds - // we restore the original value - const showPopupBefore = this.showClickPopups - this.showClickPopups = false - setTimeout(() => { - context.showClickPopups = showPopupBefore - }, 2000) - // Force the active route polyline to render again // after a timeout in order to make sure it // is over the other polylines @@ -1358,7 +1349,7 @@ export default { EventBus.$emit('mapRightClicked', data) } this.clickLatLng = { lat: event.latlng.lat, lng: event.latlng.lng } - } else if (this.$store.getters.isSidebarVisible) { + } else if (this.$store.getters.isSidebarVisible && this.$lowResolution) { EventBus.$emit('setSidebarStatus', false) } }, diff --git a/src/pages/maps/maps.js b/src/pages/maps/maps.js index 046d7fc1e..a26c3f70b 100644 --- a/src/pages/maps/maps.js +++ b/src/pages/maps/maps.js @@ -51,7 +51,7 @@ export default { }, computed: { showMapViewClickPopups () { - let show = ((!this.$store.getters.isSidebarVisible || this.$highResolution) || (this.$highResolution && this.$store.getters.leftSideBarPinned)) && !this.showBottomNav + let show = ((!this.$store.getters.isSidebarVisible || this.$mdAndUpResolution) || (this.$mdAndUpResolution && this.$store.getters.leftSideBarPinned)) && !this.showBottomNav return show }, /** From f83e5edb2896012b83e3d94d9672eea59ca8e15f Mon Sep 17 00:00:00 2001 From: Amandus Butzer Date: Fri, 23 Aug 2024 13:59:44 +0200 Subject: [PATCH 3/7] fix: extra info highlights not recalculated after the refactoring of the extra info, it was only calculated once during creation of the route-extras component. It is now also calculated on route changes. Moving the map also triggers a route change but value doesn't change, which is treated within the watch handler. --- .../components/extras/route-extras.js | 37 +++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/src/fragments/forms/map-form/components/place-and-directions/components/route-details/components/extras/route-extras.js b/src/fragments/forms/map-form/components/place-and-directions/components/route-details/components/extras/route-extras.js index db0aac3a7..132911c5c 100644 --- a/src/fragments/forms/map-form/components/place-and-directions/components/route-details/components/extras/route-extras.js +++ b/src/fragments/forms/map-form/components/place-and-directions/components/route-details/components/extras/route-extras.js @@ -1,5 +1,6 @@ import orsDictionary from '@/resources/ors-dictionary' import {EventBus} from '@/common/event-bus' +import Utils from '@/support/utils' export default { data () { @@ -13,6 +14,17 @@ export default { Required: true } }, + watch: { + route: { + handler: function (newVal, oldVal) { + // avoid update on map center move + let diff = Utils.getObjectsDiff(newVal, oldVal) + if (diff.different.length) { + this.showFromExistingSetting() + } + } + } + }, computed: { /** * Return the array of extras or an empty array @@ -23,19 +35,22 @@ export default { } }, created() { - // get current displayed extras - let {key: extraKey, value: extraValue, index: index} = this.$store.getters.extraHighlight - if (extraKey) { - this.showExtraInfoSection = 0 // show extra section - // does the active route have the specific extraValue? - if (this.routeExtras[extraKey].summary.map(e => e.value).includes(extraValue)) { - this.showSection(extraKey, extraValue, index) - } else { - this.showAllSections(extraKey) - } - } + this.showFromExistingSetting() }, methods: { + showFromExistingSetting() { + // get current displayed extras + let {key: extraKey, value: extraValue, index: index} = this.$store.getters.extraHighlight + if (extraKey) { + this.showExtraInfoSection = 0 // show extra section + // does the active route have the specific extraValue? + if (this.routeExtras[extraKey].summary.map(e => e.value).includes(extraValue)) { + this.showSection(extraKey, extraValue, index) + } else { + this.showAllSections(extraKey) + } + } + }, /** * Determines if a given * extra must be shown by From 7fdb00d8181dc1260dc0d02ef031950052c04a56 Mon Sep 17 00:00:00 2001 From: Amandus Butzer Date: Fri, 23 Aug 2024 14:47:02 +0200 Subject: [PATCH 4/7] feat: sort steepness by value --- .../components/route-details/components/extras/route-extras.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/fragments/forms/map-form/components/place-and-directions/components/route-details/components/extras/route-extras.js b/src/fragments/forms/map-form/components/place-and-directions/components/route-details/components/extras/route-extras.js index 132911c5c..cfa7b7c95 100644 --- a/src/fragments/forms/map-form/components/place-and-directions/components/route-details/components/extras/route-extras.js +++ b/src/fragments/forms/map-form/components/place-and-directions/components/route-details/components/extras/route-extras.js @@ -31,6 +31,9 @@ export default { * @returns {Array} */ routeExtras () { + if (this.route.properties.extras?.['steepness']) { + this.route.properties.extras['steepness'].summary = this.route.properties.extras['steepness'].summary.sort((a, b) => parseInt(a.value) - parseInt(b.value)) + } return this.route.properties.extras || [] } }, From 89a86a82fa9e68695868756f0a0f608bd43aba13 Mon Sep 17 00:00:00 2001 From: Amandus Butzer Date: Fri, 23 Aug 2024 14:51:03 +0200 Subject: [PATCH 5/7] feat: add map scale --- src/fragments/map-view/MapView.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/fragments/map-view/MapView.vue b/src/fragments/map-view/MapView.vue index bf473b82b..f108bc5a4 100644 --- a/src/fragments/map-view/MapView.vue +++ b/src/fragments/map-view/MapView.vue @@ -24,6 +24,7 @@ :style="{height: mapHeight + 'px'}"> + From 5233a2216df9738c2e441bf7a3861617153f3c82 Mon Sep 17 00:00:00 2001 From: Amandus Butzer Date: Fri, 23 Aug 2024 15:01:26 +0200 Subject: [PATCH 6/7] fix: show extra info snackbar on top of controls e.g. map attribution --- .../components/extra-info-highlight/ExtraInfoHighlight.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fragments/map-view/components/extra-info-highlight/ExtraInfoHighlight.vue b/src/fragments/map-view/components/extra-info-highlight/ExtraInfoHighlight.vue index 43e1b31c8..fb19bb73e 100644 --- a/src/fragments/map-view/components/extra-info-highlight/ExtraInfoHighlight.vue +++ b/src/fragments/map-view/components/extra-info-highlight/ExtraInfoHighlight.vue @@ -9,7 +9,7 @@