From b2a2c86fc4b2d6dee9aff6c7c2367735de2e4d08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=A9o?= <92678879+neo-garaix@users.noreply.github.com> Date: Tue, 3 Dec 2024 17:43:48 +0100 Subject: [PATCH] Fixing bug about the print overlay stacking (#5069) * FIX: Remove print overlay when change minidock fix #5068 --- assets/src/components/Print.js | 3 +++ tests/end2end/playwright/print.spec.js | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/assets/src/components/Print.js b/assets/src/components/Print.js index f9e06f16f4..8750ed0409 100644 --- a/assets/src/components/Print.js +++ b/assets/src/components/Print.js @@ -107,6 +107,9 @@ export default class Print extends HTMLElement { mainLizmap.map.getView().on('change:resolution', this._onChangeResolution); render(this._template(), this); + } else if (e.navElements.includes('print nav-minidock active')) { // Remove print overlay when clicking on another minidock + mainLizmap.map.removeToolLayer(this._maskLayer); + mainLizmap.map.getView().un('change:resolution', this._onChangeResolution); } }, minidockclosed: (e) => { diff --git a/tests/end2end/playwright/print.spec.js b/tests/end2end/playwright/print.spec.js index 6c76371e2d..75858d91b5 100644 --- a/tests/end2end/playwright/print.spec.js +++ b/tests/end2end/playwright/print.spec.js @@ -697,4 +697,12 @@ test.describe('Error while printing', () => { await expect(page.locator("#message > div:last-child")).toHaveClass(/alert-error/); }); + + test('Remove print overlay when switching to another minidock', async ({ page }) => { + await page.locator('#button-print').click(); + + await page.locator('#button-selectiontool').click(); + + await expect(page.locator('.ol-unselectable > canvas')).toHaveCount(0); + }); });