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 <RectangleShape key={obj.id} {...commonProps} />;
case "circle":
return <CircleShape key={obj.id} {...commonProps} />;
case "text":
return <TextShape key={obj.id} {...commonProps} layerRef={layerRef} />;
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") {
return {
id: tempObject?.id || `line-${Date.now()}`,
@@ -91,10 +91,7 @@ export const useDrawingHandlers = () => {
addObject(newObject);
setTempObject(newObject);
} else {
const updates: Partial<EditorObject> =
tool === "circle"
? { width: newObject.width, height: newObject.height }
: {
const updates: Partial<EditorObject> = {
x: newObject.x,
y: newObject.y,
width: newObject.width,
@@ -32,7 +32,7 @@ const ObjectSettings = ({ selectedObject, onUpdate, onDelete }: ObjectSettingsPr
{selectedObject.type === "text" && <TextInstruction />}
{(selectedObject.type === "rectangle" || selectedObject.type === "circle") && (
{selectedObject.type === "rectangle" && (
<ShapeSettings selectedObject={selectedObject} onUpdate={onUpdate} />
)}
@@ -6,7 +6,6 @@ import {
LinkInput,
SelectInstruction,
RectangleInstruction,
CircleInstruction,
TextInstruction,
LineInstruction,
ArrowInstruction,
@@ -67,7 +66,6 @@ const ToolInstructions = ({ tool }: ToolInstructionsProps) => {
const simpleInstructions: Partial<Record<ToolType, React.ReactElement>> = {
select: <SelectInstruction />,
rectangle: <RectangleInstruction />,
circle: <CircleInstruction />,
text: <TextInstruction />,
line: <LineInstruction />,
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 }> = [
{ 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: "circle", 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) => <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 =
| "select"
| "rectangle"
| "circle"
| "text"
| "image"
| "line"