remove dublicate circle
This commit is contained in:
@@ -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,15 +91,12 @@ export const useDrawingHandlers = () => {
|
||||
addObject(newObject);
|
||||
setTempObject(newObject);
|
||||
} else {
|
||||
const updates: Partial<EditorObject> =
|
||||
tool === "circle"
|
||||
? { width: newObject.width, height: newObject.height }
|
||||
: {
|
||||
x: newObject.x,
|
||||
y: newObject.y,
|
||||
width: newObject.width,
|
||||
height: newObject.height,
|
||||
};
|
||||
const updates: Partial<EditorObject> = {
|
||||
x: newObject.x,
|
||||
y: newObject.y,
|
||||
width: newObject.width,
|
||||
height: newObject.height,
|
||||
};
|
||||
updateObject(tempObject.id, updates);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user