From b75171777164596d59b59ef0463ddc4cb45b4b76 Mon Sep 17 00:00:00 2001 From: mistic100 Date: Sun, 5 Feb 2023 21:04:57 +0100 Subject: [PATCH] Fix #851 map: display issue when calling minimize()+hide() --- examples/plugin-map.html | 2 +- packages/map-plugin/src/components/MapComponent.ts | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/examples/plugin-map.html b/examples/plugin-map.html index ef3337bbe..b71366223 100644 --- a/examples/plugin-map.html +++ b/examples/plugin-map.html @@ -36,7 +36,7 @@ defaultZoom: 40, // position: 'top left', // maxZoom: 300, - // compassImage: null, + // overlayImage: null, // static: true, // visibleOnLoad: false, hotspots: [ diff --git a/packages/map-plugin/src/components/MapComponent.ts b/packages/map-plugin/src/components/MapComponent.ts index 47d3a9429..cc1b65d8f 100644 --- a/packages/map-plugin/src/components/MapComponent.ts +++ b/packages/map-plugin/src/components/MapComponent.ts @@ -211,7 +211,7 @@ export class MapComponent extends AbstractComponent { this.state.forceRender = true; break; case 'transitionend': - if (!this.state.maximized && this.overlay) { + if (!this.state.maximized) { this.overlay.style.display = ''; } this.state.forceRender = false; @@ -253,9 +253,17 @@ export class MapComponent extends AbstractComponent { return this.state.visible && !this.state.collapsed; } - override show(): void { + override show() { super.show(); this.update(); + if (!this.state.maximized) { + this.overlay.style.display = ''; + } + } + + override hide() { + super.hide(); + this.state.forceRender = false; } /** @@ -324,7 +332,7 @@ export class MapComponent extends AbstractComponent { utils.toggleClass(this.container, 'psv-map--maximized', this.state.maximized); - if (this.state.maximized && this.overlay) { + if (this.state.maximized) { this.overlay.style.display = 'none'; }