Skip to content

Commit 1db566b

Browse files
Merge pull request #71 from JPL-Devin/devin/1778524166-fix-globe-render-on-toggle
fix: render Globe panel immediately on first open without window resize
2 parents 9652783 + d445c4e commit 1db566b

4 files changed

Lines changed: 29 additions & 6 deletions

File tree

configure/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "configure",
3-
"version": "5.0.2-20260511",
3+
"version": "5.0.3-20260511",
44
"homepage": "./configure/build",
55
"private": true,
66
"dependencies": {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mmgis",
3-
"version": "5.0.2-20260511",
3+
"version": "5.0.3-20260511",
44
"description": "A web-based mapping and localization solution for science operation on planetary missions.",
55
"homepage": "build",
66
"repository": {

src/essence/Basics/UserInterface_/components/TopBar/TopBar.jsx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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)

src/essence/Basics/UserInterface_/store/uiStore.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,19 @@ const useUIStore = create((set, get) => ({
195195
const current = get()
196196
if (current._Globe && !current._Globe.hasBeenOpened) {
197197
current._Globe.hasBeenOpened = true
198+
current._Globe.init()
198199
if (current._L && current._L.FUTURES.globeView == null) {
199200
setTimeout(() => {
200201
current._Globe.syncToMapCenter()
201202
}, 100)
202203
}
203204
}
205+
// Always invalidateSize when globe opens, even if already initialized
206+
if (current._Globe && current._Globe.litho) {
207+
requestAnimationFrame(() => {
208+
current._Globe.litho.invalidateSize()
209+
})
210+
}
204211
}, 0)
205212
}
206213
},

0 commit comments

Comments
 (0)