remove dublicate circle

This commit is contained in:
hamid zarghami
2025-11-26 16:06:23 +03:30
parent 4203cc1fd2
commit 56bfdbfe2e
7 changed files with 7 additions and 31 deletions
@@ -53,8 +53,6 @@ const ObjectRenderer = ({
return <AbstractShape key={obj.id} {...commonProps} />; return <AbstractShape key={obj.id} {...commonProps} />;
} }
return <RectangleShape key={obj.id} {...commonProps} />; return <RectangleShape key={obj.id} {...commonProps} />;
case "circle":
return <CircleShape key={obj.id} {...commonProps} />;
case "text": case "text":
return <TextShape key={obj.id} {...commonProps} layerRef={layerRef} />; return <TextShape key={obj.id} {...commonProps} layerRef={layerRef} />;
case "line": case "line":
@@ -33,21 +33,6 @@ export const createDrawingObject = ({
}; };
} }
if (tool === "circle") {
const radius = Math.sqrt(width * width + height * height);
return {
id: tempObject?.id || `circle-${Date.now()}`,
type: "circle",
x: startPos.x,
y: startPos.y,
width: radius * 2,
height: radius * 2,
fill: "#10b981",
stroke: "#059669",
strokeWidth: 0,
};
}
if (tool === "line") { if (tool === "line") {
return { return {
id: tempObject?.id || `line-${Date.now()}`, id: tempObject?.id || `line-${Date.now()}`,
@@ -91,15 +91,12 @@ export const useDrawingHandlers = () => {
addObject(newObject); addObject(newObject);
setTempObject(newObject); setTempObject(newObject);
} else { } else {
const updates: Partial<EditorObject> = const updates: Partial<EditorObject> = {
tool === "circle" x: newObject.x,
? { width: newObject.width, height: newObject.height } y: newObject.y,
: { width: newObject.width,
x: newObject.x, height: newObject.height,
y: newObject.y, };
width: newObject.width,
height: newObject.height,
};
updateObject(tempObject.id, updates); updateObject(tempObject.id, updates);
} }
}; };
@@ -32,7 +32,7 @@ const ObjectSettings = ({ selectedObject, onUpdate, onDelete }: ObjectSettingsPr
{selectedObject.type === "text" && <TextInstruction />} {selectedObject.type === "text" && <TextInstruction />}
{(selectedObject.type === "rectangle" || selectedObject.type === "circle") && ( {selectedObject.type === "rectangle" && (
<ShapeSettings selectedObject={selectedObject} onUpdate={onUpdate} /> <ShapeSettings selectedObject={selectedObject} onUpdate={onUpdate} />
)} )}
@@ -6,7 +6,6 @@ import {
LinkInput, LinkInput,
SelectInstruction, SelectInstruction,
RectangleInstruction, RectangleInstruction,
CircleInstruction,
TextInstruction, TextInstruction,
LineInstruction, LineInstruction,
ArrowInstruction, ArrowInstruction,
@@ -67,7 +66,6 @@ const ToolInstructions = ({ tool }: ToolInstructionsProps) => {
const simpleInstructions: Partial<Record<ToolType, React.ReactElement>> = { const simpleInstructions: Partial<Record<ToolType, React.ReactElement>> = {
select: <SelectInstruction />, select: <SelectInstruction />,
rectangle: <RectangleInstruction />, rectangle: <RectangleInstruction />,
circle: <CircleInstruction />,
text: <TextInstruction />, text: <TextInstruction />,
line: <LineInstruction />, line: <LineInstruction />,
arrow: <ArrowInstruction />, arrow: <ArrowInstruction />,
@@ -17,7 +17,6 @@ import type { ToolType } from "../../store/editorStore";
const tools: Array<{ icon: (color: string, variant?: "Bold" | "Outline" | "Broken" | "Bulk" | "Linear" | "TwoTone") => React.ReactNode; tool: ToolType; label: string }> = [ const tools: Array<{ icon: (color: string, variant?: "Bold" | "Outline" | "Broken" | "Bulk" | "Linear" | "TwoTone") => React.ReactNode; tool: ToolType; label: string }> = [
{ icon: (color, variant) => <MouseSquare size={20} color={color} variant={variant} />, tool: "select", label: "انتخاب" }, { icon: (color, variant) => <MouseSquare size={20} color={color} variant={variant} />, tool: "select", label: "انتخاب" },
{ icon: (color, variant) => <Shapes size={20} color={color} variant={variant} />, tool: "rectangle", label: "مستطیل" }, { icon: (color, variant) => <Shapes size={20} color={color} variant={variant} />, tool: "rectangle", label: "مستطیل" },
{ icon: (color, variant) => <Shapes size={20} color={color} variant={variant} />, tool: "circle", label: "دایره" },
{ icon: (color, variant) => <Text size={20} color={color} variant={variant} />, tool: "text", label: "متن" }, { icon: (color, variant) => <Text size={20} color={color} variant={variant} />, tool: "text", label: "متن" },
{ icon: (color, variant) => <Minus size={20} color={color} variant={variant} />, tool: "line", label: "خط" }, { icon: (color, variant) => <Minus size={20} color={color} variant={variant} />, tool: "line", label: "خط" },
{ icon: (color, variant) => <Grid8 size={20} color={color} variant={variant} />, tool: "grid", label: "گرید" }, { icon: (color, variant) => <Grid8 size={20} color={color} variant={variant} />, tool: "grid", label: "گرید" },
-1
View File
@@ -5,7 +5,6 @@ import type { ShapeType } from "./shapeStore";
export type ToolType = export type ToolType =
| "select" | "select"
| "rectangle" | "rectangle"
| "circle"
| "text" | "text"
| "image" | "image"
| "line" | "line"