From 0f56eed27250d95aa7cd2cc6643c2796b3cebd27 Mon Sep 17 00:00:00 2001 From: mike-000 <49240900+mike-000@users.noreply.github.com> Date: Mon, 16 Aug 2021 23:43:43 +0100 Subject: [PATCH] only warn of zero size when map should be visible --- src/ol/PluggableMap.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ol/PluggableMap.js b/src/ol/PluggableMap.js index 8948e609e4..374d18ed34 100644 --- a/src/ol/PluggableMap.js +++ b/src/ol/PluggableMap.js @@ -1524,7 +1524,14 @@ class PluggableMap extends BaseObject { parseFloat(computedStyle['borderBottomWidth']); if (!isNaN(width) && !isNaN(height)) { size = [width, height]; - if (!hasArea(size)) { + if ( + !hasArea(size) && + !!( + targetElement.offsetWidth || + targetElement.offsetHeight || + targetElement.getClientRects().length + ) + ) { // eslint-disable-next-line console.warn( "No map visible because the map container's width or height are 0."