Skip to content

Virtual whiteboard for sketching hand-drawn like diagrams

Ensure arrows are not draggable from inside (#1620)

Preet584e4182a7bc
diff --git a/src/element/collision.ts b/src/element/collision.ts
index 3d5d47b5e9..79fa4f383c 100644
--- a/src/element/collision.ts
+++ b/src/element/collision.ts
@@ -23,6 +23,9 @@ const isElementDraggableFromInside = (
element: NonDeletedExcalidrawElement,
appState: AppState,
): boolean => {
+ if (element.type === "arrow") {
+ return false;
+ }
const dragFromInside =
element.backgroundColor !== "transparent" ||
appState.selectedElementIds[element.id];
diff --git a/src/renderer/renderElement.ts b/src/renderer/renderElement.ts
index 836fa871d5..18339fb186 100644
--- a/src/renderer/renderElement.ts
+++ b/src/renderer/renderElement.ts
@@ -192,22 +192,20 @@ export const generateRoughOptions = (element: ExcalidrawElement): Options => {
return options;
}
case "line":
- case "draw":
- case "arrow": {
+ case "draw": {
// If shape is a line and is a closed shape,
// fill the shape if a color is set.
- if (element.type === "line" || element.type === "draw") {
- if (isPathALoop(element.points)) {
- options.fillStyle = element.fillStyle;
- options.fill =
- element.backgroundColor === "transparent"
- ? undefined
- : element.backgroundColor;
- }
+ if (isPathALoop(element.points)) {
+ options.fillStyle = element.fillStyle;
+ options.fill =
+ element.backgroundColor === "transparent"
+ ? undefined
+ : element.backgroundColor;
}
-
return options;
}
+ case "arrow":
+ return options;
default: {
throw new Error(`Unimplemented type ${element.type}`);
}