Skip to content

Commit

Permalink
More consistent mobile display
Browse files Browse the repository at this point in the history
  • Loading branch information
brentyi committed Oct 12, 2023
1 parent 4623405 commit c889fc8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/viser/client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ function ViewerCanvas({ children }: { children: React.ReactNode }) {
}}
performance={{ min: 0.95 }}
ref={viewer.canvasRef}
// Handle scene click events.
onClick={(e) => {
// Don't send click events if the scene pointer events are disabled.
if (!viewer.sceneClickEnable.current) return;
Expand Down
10 changes: 10 additions & 0 deletions src/viser/client/src/ControlPanel/BottomPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,13 @@ BottomPanel.Contents = function BottomPanelContents({
const panelContext = React.useContext(BottomPanelContext)!;
return <Collapse in={panelContext.expanded}>{children}</Collapse>;
};

/** Hides contents when panel is collapsed. */
BottomPanel.HideWhenCollapsed = function BottomPanelHideWhenCollapsed({
children,
}: {
children: React.ReactNode;
}) {
const expanded = React.useContext(BottomPanelContext)?.expanded ?? true;
return expanded ? children : null;
};
4 changes: 3 additions & 1 deletion src/viser/client/src/ControlPanel/ControlPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ export default function ControlPanel(props: {
<BottomPanel>
<BottomPanel.Handle>
<ConnectionStatus />
{generatedServerToggleButton}
<BottomPanel.HideWhenCollapsed>
{generatedServerToggleButton}
</BottomPanel.HideWhenCollapsed>
</BottomPanel.Handle>
<BottomPanel.Contents>{panelContents}</BottomPanel.Contents>
</BottomPanel>
Expand Down

0 comments on commit c889fc8

Please sign in to comment.