@@ -223,24 +223,34 @@ const removeFeatures = () => {
223223// RESIZE MAP
224224
225225const resize = () => {
226+ log (' resizing map' );
227+
226228 const { sizer } = props;
227229 const result = sizer ();
228230 if (result != null ) {
231+ log (' return value from sizer prop:' , result);
229232 // Here, we set the element's min-height, not its full height.
230233 // .map-container also has a min-height, and if that's greater than the
231234 // min-height here, the element will be taller than its min-height.
232235 el .value .style .minHeight = typeof result === ' number'
233236 ? (result > 0 ? px (result) : ' ' )
234237 : result;
235238 }
239+ log (' min-height of .geojson-map:' , el .value .style .minHeight );
236240
237241 // .map-container seems to need a concrete height to be set on it (e.g.,
238- // setting `height: 100%;` in CSS didn't work).
239- mapContainer .value .style .height = px (el .value .getBoundingClientRect ().height );
242+ // setting `height: 100%;` in CSS didn't work). Before setting it, we first
243+ // unset it: we need to undo any previous resize() call before recalculating
244+ // the height.
245+ mapContainer .value .style .height = ' ' ;
246+ const newHeight = px (el .value .getBoundingClientRect ().height );
247+ mapContainer .value .style .height = newHeight;
248+ log (' height of .map-container:' , newHeight);
240249
241- const oldSize = mapInstance .getSize ();
242250 mapInstance .updateSize ();
243- if (! equals (mapInstance .getSize (), oldSize)) log (' resized' );
251+ log (' size of mapInstance:' , mapInstance .getSize ());
252+
253+ log (' done resizing' );
244254};
245255
246256
0 commit comments