diff --git a/packages/client/src/components/document/fullscreen/index.module.scss b/packages/client/src/components/document/fullscreen/index.module.scss index e26fe9c2..0d65f6bd 100644 --- a/packages/client/src/components/document/fullscreen/index.module.scss +++ b/packages/client/src/components/document/fullscreen/index.module.scss @@ -91,18 +91,18 @@ .fullScreenToolbar { position: fixed; - bottom: 10px; - left: 10px; + bottom: 40px; + left: 50%; z-index: 2; padding: 12px; background-color: rgb(var(--semi-grey-9)); border-radius: var(--semi-border-radius-medium); - opacity: 0.1; - transition: opacity 0.3s ease-in-out; + opacity: 0; + transform: translateX(-50%); + transition: opacity 0.5s ease-in-out; - &:hover { + &.isVisible { opacity: 1; - transition: opacity 0.3s ease-in-out; } .selected { diff --git a/packages/client/src/components/document/fullscreen/index.tsx b/packages/client/src/components/document/fullscreen/index.tsx index cd67f0d0..9fb8a37a 100644 --- a/packages/client/src/components/document/fullscreen/index.tsx +++ b/packages/client/src/components/document/fullscreen/index.tsx @@ -7,14 +7,19 @@ import { IconPencil } from 'components/icons/IconPencil'; import { safeJSONParse } from 'helpers/json'; import { useDrawingCursor } from 'hooks/use-cursor'; import { useToggle } from 'hooks/use-toggle'; -import React, { useCallback, useEffect, useState } from 'react'; +import React, { useCallback, useEffect, useRef, useState } from 'react'; import { FullScreen, useFullScreenHandle } from 'react-full-screen'; import { CollaborationKit, Document } from 'tiptap/editor'; import styles from './index.module.scss'; +const { Title } = Typography; + // 控制器 const FullscreenController = ({ handle: fullscreenHandler, isDrawing, toggleDrawing }) => { + const timerRef = useRef>(null); + const [visible, toggleVisible] = useState(true); + const startDrawing = useCallback(() => { toggleDrawing(!isDrawing); }, [isDrawing, toggleDrawing]); @@ -24,8 +29,21 @@ const FullscreenController = ({ handle: fullscreenHandler, isDrawing, toggleDraw toggleDrawing(false); }, [fullscreenHandler, toggleDrawing]); + useEffect(() => { + timerRef.current = setTimeout(() => { + toggleVisible(false); + }, 2000); + }, [toggleVisible]); + return ( -
+
{ + clearTimeout(timerRef.current); + toggleVisible(true); + }} + onMouseLeave={() => toggleVisible(false)} + >