Forráskód Böngészése

hide stats and scrollToContent-button when mobile menus open (#2509)

David Luzar 4 éve
szülő
commit
ae15380a9f
2 módosított fájl, 7 hozzáadás és 1 törlés
  1. 1 1
      src/components/MobileMenu.tsx
  2. 6 0
      src/components/Stats.tsx

+ 1 - 1
src/components/MobileMenu.tsx

@@ -154,7 +154,7 @@ export const MobileMenu = ({
             )}
             {actionManager.renderAction("deleteSelectedElements")}
           </div>
-          {appState.scrolledOutside && (
+          {appState.scrolledOutside && !appState.openMenu && (
             <button
               className="scroll-back-to-content"
               onClick={() => {

+ 6 - 0
src/components/Stats.tsx

@@ -6,6 +6,7 @@ import {
   getTotalStorageSize,
 } from "../excalidraw-app/data/localStorage";
 import { t } from "../i18n";
+import useIsMobile from "../is-mobile";
 import { getTargetElements } from "../scene";
 import { AppState } from "../types";
 import { debounce, nFormatter } from "../utils";
@@ -27,6 +28,7 @@ export const Stats = (props: {
   elements: readonly NonDeletedExcalidrawElement[];
   onClose: () => void;
 }) => {
+  const isMobile = useIsMobile();
   const [storageSizes, setStorageSizes] = useState<StorageSizes>({
     scene: 0,
     total: 0,
@@ -44,6 +46,10 @@ export const Stats = (props: {
   const selectedElements = getTargetElements(props.elements, props.appState);
   const selectedBoundingBox = getCommonBounds(selectedElements);
 
+  if (isMobile && props.appState.openMenu) {
+    return null;
+  }
+
   return (
     <div className="Stats">
       <Island padding={2}>