Skip to content

Commit

Permalink
Merge pull request #234 from prixe/fix-visibility-issue-with-game-tab
Browse files Browse the repository at this point in the history
Fix visibility issue with multiple game tabs (could introduce issues in DT UI)
  • Loading branch information
zenoxs authored Aug 15, 2022
2 parents 3b1c473 + 8aeaad0 commit ad941f8
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 18 deletions.
43 changes: 26 additions & 17 deletions packages/renderer/src/screens/main-screen/MainScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,32 @@ export const MainScreen = () => {
<TabManager>
<Box sx={{ display: 'flex', flex: 1 }} height='100%' width='100vw'>
<SideBar />
<Observer>
{() => (
<>
{gameStore.games.map((game) => (
<div
style={{
flex: 1,
display: gameStore.selectedGame?.id !== game.id ? 'none' : 'flex'
}}
key={game.id}
>
<GameScreen key={game.id} game={game} />
</div>
))}
</>
)}
</Observer>
<Box sx={{ display: 'flex', position: 'relative', flex: 1 }}>
<Observer>
{() => (
<>
{gameStore.games.map((game) => {
const selected = gameStore.selectedGame?.id === game.id
return (
<div
style={{
display: 'block',
width: '100%',
height: '100%',
position: 'absolute',
overflow: 'hidden',
visibility: selected ? 'visible' : 'hidden'
}}
key={game.id}
>
<GameScreen key={game.id} game={game} />
</div>
)
})}
</>
)}
</Observer>
</Box>
</Box>
</TabManager>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const GameScreen = memo(({ game }: GameScreenProps) => {
id={`iframe-game-${game.id}`}
ref={iframeGameRef}
onLoad={handleLoad}
style={{ flex: 1, border: 'none' }}
style={{ border: 'none', width: '100%', height: '100%' }}
src={gameContext.gameSrc}
/>
)
Expand Down

0 comments on commit ad941f8

Please sign in to comment.