@@ -244,22 +244,38 @@ function TopBar({ userInterface }) {
244244 if ( userInterface && userInterface . setPanelPercents ) {
245245 const Globe_ = require ( '../../../Globe_/Globe_' ) . default
246246 const newState = ! ( useUIStore . getState ( ) . pxIsGlobe > 0 )
247- if ( newState && ! Globe_ . hasBeenOpened ) {
248- Globe_ . init ( )
249- Globe_ . hasBeenOpened = true
250- }
247+
251248 if ( isMobile ) {
252249 const isOpen = useUIStore . getState ( ) . pxIsGlobe > 0
253250 if ( ! isOpen ) {
254251 userInterface . setPanelPercents ( 0 , 0 , 100 )
252+ if ( ! Globe_ . hasBeenOpened ) {
253+ requestAnimationFrame ( ( ) => {
254+ Globe_ . init ( )
255+ Globe_ . hasBeenOpened = true
256+ requestAnimationFrame ( ( ) => {
257+ if ( Globe_ . litho ) Globe_ . litho . invalidateSize ( )
258+ } )
259+ } )
260+ }
255261 }
256262 return
257263 }
264+
258265 const pp = userInterface . getPanelPercents ( )
259266 if ( newState ) {
260267 const viewerAmt = pp . viewer > 0 ? 33 : 0
261268 const mapAmt = 100 - 33 - viewerAmt
262269 userInterface . setPanelPercents ( viewerAmt , mapAmt , 33 )
270+ if ( ! Globe_ . hasBeenOpened ) {
271+ requestAnimationFrame ( ( ) => {
272+ Globe_ . init ( )
273+ Globe_ . hasBeenOpened = true
274+ requestAnimationFrame ( ( ) => {
275+ if ( Globe_ . litho ) Globe_ . litho . invalidateSize ( )
276+ } )
277+ } )
278+ }
263279 } else {
264280 if ( pp . map > 0 && pp . viewer > 0 ) {
265281 userInterface . setPanelPercents ( pp . viewer + pp . globe / 2 , pp . map + pp . globe / 2 , 0 )
0 commit comments