diff --git a/src/App.css b/src/App.css index 3bd0fa3..a45caef 100644 --- a/src/App.css +++ b/src/App.css @@ -6,16 +6,6 @@ .tooltip { --tooltip-spacing: 30px; } -/* Hide scrollbar for Chrome, Safari and Opera */ -.example::-webkit-scrollbar { - display: none; -} - -/* Hide scrollbar for IE, Edge and Firefox */ -.example { - -ms-overflow-style: none; /* IE and Edge */ - scrollbar-width: none; /* Firefox */ -} .\[\&_svg\]\:size-4 svg { width: 1.3rem !important; diff --git a/src/components/Panel/TopBar.jsx b/src/components/Panel/TopBar.jsx index 3397c06..901de91 100644 --- a/src/components/Panel/TopBar.jsx +++ b/src/components/Panel/TopBar.jsx @@ -1,13 +1,12 @@ +import { useContext, useRef, useState } from "react"; import TextCustomization from "../EachComponent/Customization/TextCustomization"; import LockObject from "../EachComponent/Customization/LockObject"; -import { ScrollArea, ScrollBar } from "../ui/scroll-area"; import OpacityCustomization from "../EachComponent/Customization/OpacityCustomization"; import CanvasContext from "../Context/canvasContext/CanvasContext"; -import { useContext } from "react"; import { ObjectShortcut } from "../ObjectShortcut"; import ActiveObjectContext from "../Context/activeObject/ObjectContext"; import { Button } from "../ui/button"; -import { ImagePlus } from "lucide-react"; +import { ImagePlus, ChevronLeft, ChevronRight } from "lucide-react"; import { RxBorderWidth } from "react-icons/rx"; import { LuFlipVertical } from "react-icons/lu"; import { SlTarget } from "react-icons/sl"; @@ -22,180 +21,220 @@ export function TopBar() { const activeObjectType = activeObject?.type; const hasClipPath = !!activeObject?.clipPath; const customClipPath = activeObject?.isClipPath; + const scrollContainerRef = useRef(null); + const [showScrollButtons, setShowScrollButtons] = useState(false); + + const scroll = (direction) => { + const container = scrollContainerRef.current; + if (container) { + const scrollAmount = 200; // Adjust this value to change scroll distance + container.scrollBy({ + left: direction * scrollAmount, + behavior: "smooth", + }); + } + }; + return ( -
- -
-
- -
-
+
setShowScrollButtons(true)} + onMouseLeave={() => setShowScrollButtons(false)} + > +
+ {showScrollButtons && ( + <> - + + + )} +
+
+
+ -
- {activeObjectType !== "image" && - activeObject?.type !== "i-text" && - !hasClipPath && - !customClipPath && ( - + + +
+ {activeObjectType !== "image" && + activeObject?.type !== "i-text" && + !hasClipPath && + !customClipPath && ( + + + + )} + + + {!customClipPath && ( + + className="w-10 h-10" + onClick={() => setSelectedPanel("stroke")} + > + + )} + + {(activeObject || activeObject.type === "group") && ( + + + + )} + +
- {!customClipPath && ( - + + +
-
- - - -
- -
- -
-
-
- - - - - - - - - - +
); }