diff --git a/src/api/print.api.js b/src/api/print.api.js index a71befac57..36c56e86d4 100644 --- a/src/api/print.api.js +++ b/src/api/print.api.js @@ -67,6 +67,8 @@ class GeoAdminCustomizer extends BaseCustomizer { if (symbolizer.strokeWidth) { symbolizer.strokeWidth = adjustWidth(symbolizer.strokeWidth, this.printResolution) } + symbolizer.graphicXOffset = symbolizer.graphicXOffset ?? 0 + symbolizer.graphicYOffset = symbolizer.graphicYOffset ?? 0 } /** @@ -134,7 +136,7 @@ class GeoAdminCustomizer extends BaseCustomizer { ) : 0 // don't ask why it works, but that's the best I could do. - symbolizer.gaphicYOffset = Math.round(1000 * symbolizer.gaphicYOffset ?? 0) / 1000 + symbolizer.graphicYOffset = Math.round(1000 * symbolizer.graphicYOffset ?? 0) / 1000 } if (size) { symbolizer.graphicWidth = adjustWidth(size[0] * scale, this.printResolution) diff --git a/src/api/profile/profile.api.js b/src/api/profile/profile.api.js index 62046722cf..100b7f361d 100644 --- a/src/api/profile/profile.api.js +++ b/src/api/profile/profile.api.js @@ -220,27 +220,33 @@ export default async (profileCoordinates, projection) => { } let lastCoordinate = null let lastDist = 0 + // The segment is divided into chunks if the amount of coordinates in the segment is greater than MAX_CHUNK_LENGTH const requestsForChunks = coordinateChunks.map((chunk) => getProfileDataForChunk(chunk, lastCoordinate, lastDist, projection) ) - + const chunks = [] for (const chunkResponse of await Promise.allSettled(requestsForChunks)) { if (chunkResponse.status === 'fulfilled') { - const segment = parseProfileFromBackendResponse( + const chunk = parseProfileFromBackendResponse( chunkResponse.value, lastDist, projection ) - if (segment) { - const newSegmentLastPoint = segment.points.slice(-1)[0] + if (chunk) { + const newSegmentLastPoint = chunk.points.slice(-1)[0] lastCoordinate = newSegmentLastPoint.coordinate lastDist = newSegmentLastPoint.dist - segments.push(segment) + chunks.push(chunk) } } else { log.error('Error while getting profile for chunk', chunkResponse.reason?.message) } } + // Here the chunks are merged into a single segment + const mergedChunks = new ElevationProfileSegment( + chunks.reduce((acc, segment) => acc.concat(segment.points), []) + ) + segments.push(mergedChunks) } return new ElevationProfile(segments) } diff --git a/src/modules/drawing/components/DrawingToolbox.vue b/src/modules/drawing/components/DrawingToolbox.vue index 57a44966a5..05a1fac164 100644 --- a/src/modules/drawing/components/DrawingToolbox.vue +++ b/src/modules/drawing/components/DrawingToolbox.vue @@ -241,7 +241,7 @@ const debounceSaveDrawingName = debounce(async (newName) => { data-cy="drawing-toolbox-delete-button" @click="showClearConfirmationModal = true" > - {{ $t('delete') }} + {{ i18n.t('delete') }}
@@ -255,7 +255,7 @@ const debounceSaveDrawingName = debounce(async (newName) => { data-cy="drawing-toolbox-share-button" @click="showShareModal = true" > - {{ $t('share') }} + {{ i18n.t('share') }}
@@ -292,7 +292,9 @@ const debounceSaveDrawingName = debounce(async (newName) => { @click="drawMenuOpen = !drawMenuOpen" > - {{ $t(drawMenuOpen ? 'close_menu' : 'open_menu') }} + {{ + i18n.t(drawMenuOpen ? 'close_menu' : 'open_menu') + }} @@ -302,12 +304,12 @@ const debounceSaveDrawingName = debounce(async (newName) => { fluid @close="onCloseClearConfirmation" > - {{ $t('confirm_remove_all_features') }} + {{ i18n.t('confirm_remove_all_features') }} @@ -315,7 +317,7 @@ const debounceSaveDrawingName = debounce(async (newName) => { diff --git a/src/modules/menu/components/help/ReportProblemButton.vue b/src/modules/menu/components/help/ReportProblemButton.vue index 47c8a5175a..3bdff996e0 100644 --- a/src/modules/menu/components/help/ReportProblemButton.vue +++ b/src/modules/menu/components/help/ReportProblemButton.vue @@ -233,7 +233,9 @@ function selectItem(dropdownItem) { -1) { window.open(documentUrl) @@ -115,6 +117,8 @@ async function printMap() { } } catch (error) { log.error('Print failed', error) + } finally { + await store.dispatch('setIsOpeningNewTab', { isOpeningNewTab: false, ...dispatcher }) } } diff --git a/src/store/modules/ui.store.js b/src/store/modules/ui.store.js index 17b936e0c2..33adace5e8 100644 --- a/src/store/modules/ui.store.js +++ b/src/store/modules/ui.store.js @@ -175,6 +175,17 @@ export default { * @type Boolean */ showDragAndDropOverlay: false, + + /** + * Flag set to true when the app is opening a new tab. + * + * This helps us decide to show or not show a warning popup for lost changes if the user + * closes the tab. In some cases, we are opening a new tab ourselves (print result) and + * don't want this popup to show up. + * + * @type Boolean + */ + isOpeningNewTab: false, }, getters: { showLoadingBar(state) { @@ -451,6 +462,9 @@ export default { setShowDragAndDropOverlay({ commit }, { showDragAndDropOverlay, dispatcher }) { commit('setShowDragAndDropOverlay', { showDragAndDropOverlay, dispatcher }) }, + setIsOpeningNewTab({ commit }, { isOpeningNewTab, dispatcher }) { + commit('setIsOpeningNewTab', { isOpeningNewTab, dispatcher }) + }, }, mutations: { setSize(state, { height, width }) { @@ -520,5 +534,7 @@ export default { removeWarning: (state, { warning }) => state.warnings.delete(warning), setShowDragAndDropOverlay: (state, { showDragAndDropOverlay }) => (state.showDragAndDropOverlay = showDragAndDropOverlay), + setIsOpeningNewTab: (state, { isOpeningNewTab }) => + (state.isOpeningNewTab = isOpeningNewTab), }, } diff --git a/src/views/MapView.vue b/src/views/MapView.vue index e21ffffd6f..dcb78c1910 100644 --- a/src/views/MapView.vue +++ b/src/views/MapView.vue @@ -1,5 +1,6 @@