forked from voxel51/fiftyone
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request voxel51#4226 from voxel51/refactor/looker-3d-impro…
…vements looker 3d improvements
- Loading branch information
Showing
6 changed files
with
58 additions
and
9 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
app/packages/looker-3d/src/action-bar/FullScreenToggler.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { fullscreen, fullscreenExit } from "@fiftyone/looker/src/icons"; | ||
import * as fos from "@fiftyone/state"; | ||
import { IconButton } from "@mui/material"; | ||
import { useCallback, useEffect, useRef } from "react"; | ||
import { useRecoilState } from "recoil"; | ||
import { ActionItem } from "../containers"; | ||
|
||
const FullScreenIcon = ({ exit }: { exit: boolean }) => { | ||
const ref = useRef<HTMLDivElement>(); | ||
|
||
useEffect(() => { | ||
if (ref) { | ||
ref.current.innerHTML = ""; | ||
ref.current.appendChild(exit ? fullscreenExit : fullscreen); | ||
} | ||
}, [exit]); | ||
|
||
return <div style={{ display: "flex" }} ref={ref} />; | ||
}; | ||
|
||
export const FullScreenToggler = () => { | ||
const [isFullScreen, setIsFullScreen] = useRecoilState(fos.fullscreen); | ||
|
||
const toggleFullScreen = useCallback(() => { | ||
setIsFullScreen((prev) => !prev); | ||
}, []); | ||
|
||
return ( | ||
<ActionItem title="Toggle Fullscreen"> | ||
<IconButton onClick={toggleFullScreen} sx={{ fontSize: 24, padding: 0 }}> | ||
{isFullScreen ? ( | ||
<FullScreenIcon exit /> | ||
) : ( | ||
<FullScreenIcon exit={false} /> | ||
)} | ||
</IconButton> | ||
</ActionItem> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters