From 8dc2cd6caa2527c85f15fa50dcf91c2fdd420704 Mon Sep 17 00:00:00 2001 From: Aidan H Date: Wed, 27 Apr 2022 17:27:05 -0600 Subject: [PATCH 1/2] More thorough popup occlusion --- src/ui/popup.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ui/popup.js b/src/ui/popup.js index 95df055cd4a..c040a7f9335 100644 --- a/src/ui/popup.js +++ b/src/ui/popup.js @@ -649,11 +649,12 @@ export default class Popup extends Evented { } _setOpacity(opacity: number) { + if (this._container) { + this._container.style.opacity = `${opacity}`; + } if (this._content) { - this._content.style.opacity = `${opacity}`; this._content.style.pointerEvents = opacity ? 'auto' : 'none'; } - if (this._tip) this._tip.style.opacity = `${opacity}`; } } From 4239e19a5a2dfdfc5cbcfa100b87324a26439e61 Mon Sep 17 00:00:00 2001 From: Aidan H Date: Wed, 27 Apr 2022 17:43:08 -0600 Subject: [PATCH 2/2] Updating unit test --- test/unit/ui/popup.test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/unit/ui/popup.test.js b/test/unit/ui/popup.test.js index 4493a621fc5..2740e147c83 100644 --- a/test/unit/ui/popup.test.js +++ b/test/unit/ui/popup.test.js @@ -563,17 +563,17 @@ test('Popup is positioned and occluded correctly on globe', (t) => { .addTo(map); t.same(popup._pos, map.project([45, 0])); - t.same(popup._content.style.opacity, 1); + t.same(popup._container.style.opacity, 1); t.same(popup._content.style.pointerEvents, 'auto'); popup.setLngLat([270, 0]); t.same(popup._pos, map.project([270, 0])); - t.same(popup._content.style.opacity, 0); + t.same(popup._container.style.opacity, 0); t.same(popup._content.style.pointerEvents, 'none'); popup.setLngLat([0, 45]); t.same(popup._pos, map.project([0, 45])); - t.same(popup._content.style.opacity, 1); + t.same(popup._container.style.opacity, 1); t.same(popup._content.style.pointerEvents, 'auto'); t.end();