-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {
- const newOpacity = value[0]; // Extract slider value
- adjustBackgroundOpacity(newOpacity); // Adjust Fabric.js background opacity
- }}
- />
-
-
-
+
+
+ Canvas Setting
+
+
-
-
-
- {
- if (canvasSettings?.width > parseInt(e.target.value)) {
- handleChange('width', parseInt(e.target.value, 10));
- }
- }}
- />
-
+
-
-
-
{
- if (canvasSettings?.height > parseInt(e.target.value)) {
- handleChange('height', parseInt(e.target.value, 10));
- }
- }}
- />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {
+ const newOpacity = value[0]; // Extract slider value
+ adjustBackgroundOpacity(newOpacity); // Adjust Fabric.js background opacity
+ }}
+ />
+
+
+
+
+
+
-
-
-
+
+
+
)
}
diff --git a/src/components/EditPanel.jsx b/src/components/EditPanel.jsx
index a782b4d..6980052 100644
--- a/src/components/EditPanel.jsx
+++ b/src/components/EditPanel.jsx
@@ -1,4 +1,3 @@
-import { Rnd } from 'react-rnd';
import { useCallback, useContext, useState } from "react"
import { Card, CardContent, CardHeader, CardTitle } from './ui/card';
import { Button } from './ui/button';
@@ -10,6 +9,7 @@ import OpenContext from './Context/openContext/OpenContext';
import CanvasContext from './Context/canvasContext/CanvasContext';
import ActiveObjectContext from './Context/activeObject/ObjectContext';
import { fabric } from 'fabric';
+import RndComponent from './Layouts/RndComponent';
export function EditPanel() {
const [isCollapsed, setIsCollapsed] = useState(false);
@@ -189,31 +189,31 @@ export function EditPanel() {
}
};
+ const rndValue = {
+ valueX: 0,
+ valueY: 20,
+ width: 250,
+ height: 0,
+ minWidth: 250,
+ maxWidth: 300,
+ minHeight: 0,
+ maxHeight: 0,
+ bound: "parent"
+ }
+
return (
-
+
-
+
Edit Panel
setIsCollapsed(!open)}>
-
@@ -373,7 +373,7 @@ export function EditPanel() {
-
+
)
}
diff --git a/src/components/Layouts/RndComponent.jsx b/src/components/Layouts/RndComponent.jsx
new file mode 100644
index 0000000..4e7f609
--- /dev/null
+++ b/src/components/Layouts/RndComponent.jsx
@@ -0,0 +1,28 @@
+import { Rnd } from 'react-rnd';
+
+const RndComponent = ({ children, value }) => {
+
+ const { valueX, valueY, width, height, minWidth, maxWidth, minHeight, maxHeight, bound } = value;
+
+ return (
+
+
+ {children}
+
+ )
+}
+
+export default RndComponent
\ No newline at end of file
diff --git a/src/components/ObjectPanel.jsx b/src/components/ObjectPanel.jsx
index a9cbefe..19f0e39 100644
--- a/src/components/ObjectPanel.jsx
+++ b/src/components/ObjectPanel.jsx
@@ -1,10 +1,9 @@
import { Button } from './ui/button'
-import { Card, CardContent, CardHeader, CardTitle } from './ui/card'
+import { Card, CardHeader, CardTitle } from './ui/card'
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from './ui/collapsible'
import { Tabs, TabsContent, TabsList, TabsTrigger } from './ui/tabs'
import { useContext, useState } from 'react'
import { PencilRuler, Shapes, Store, Upload, ChevronDown, ChevronUp, X } from 'lucide-react';
-import { Rnd } from 'react-rnd';
import OpenContext from './Context/openContext/OpenContext';
import AllIconsPage from './EachComponent/Icons/AllIcons'
import { Separator } from './ui/separator'
@@ -12,34 +11,35 @@ import { ScrollArea } from './ui/scroll-area'
import AddShapes from './Layouts/AddShapes'
import UploadImage from './EachComponent/UploadImage'
import CustomizeShape from './EachComponent/CustomizeShape'
+import RndComponent from './Layouts/RndComponent'
const ObjectPanel = () => {
const [isCollapsed, setIsCollapsed] = useState(false);
const { tabValue, setTabValue, setOpenObjectPanel } = useContext(OpenContext);
+
+ const rndValue = {
+ valueX: 0,
+ valueY: 20,
+ width: 250,
+ height: 0,
+ minWidth: 250,
+ maxWidth: 300,
+ minHeight: 0,
+ maxHeight: 400,
+ bound: "parent"
+ }
+
return (
-
+
- setOpenObjectPanel(false)}>
+ setOpenObjectPanel(false)}>
Object Panel
- setIsCollapsed(!open)}>
+ setIsCollapsed(!open)}>
@@ -48,21 +48,48 @@ const ObjectPanel = () => {
-
+
setTabValue(value)} // Sync tab state with context
>
- setTabValue("icons")}>
- Icons
+ setTabValue("icons")}
+ >
+
+ Icons
- setTabValue("shapes")}>Shapes
- setTabValue("images")}>Images
+ setTabValue("shapes")}
+ >
+
+ Shapes
+
- setTabValue("customize")}>Customize
+ setTabValue("images")}
+ >
+
+ Images
+
+
+ setTabValue("customize")}
+ >
+
+ Customize
+
{/* All icons */}
@@ -109,7 +136,7 @@ const ObjectPanel = () => {
-
+
@@ -117,7 +144,7 @@ const ObjectPanel = () => {
-
+
)
}
diff --git a/src/components/ui/scroll-area.jsx b/src/components/ui/scroll-area.jsx
index dc3d384..bdfd469 100644
--- a/src/components/ui/scroll-area.jsx
+++ b/src/components/ui/scroll-area.jsx
@@ -8,7 +8,7 @@ const ScrollArea = React.forwardRef(({ className, children, ...props }, ref) =>
ref={ref}
className={cn("relative overflow-hidden", className)}
{...props}>
-
+
{children}
@@ -24,9 +24,9 @@ const ScrollBar = React.forwardRef(({ className, orientation = "vertical", ...pr
className={cn(
"flex touch-none select-none transition-colors",
orientation === "vertical" &&
- "h-full w-2.5 border-l border-l-transparent p-[1px]",
+ "h-full w-2.5 border-l border-l-transparent p-[1px]",
orientation === "horizontal" &&
- "h-2.5 flex-col border-t border-t-transparent p-[1px]",
+ "h-2.5 flex-col border-t border-t-transparent p-[1px]",
className
)}
{...props}>