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); + }); });