Ensure arrows are not draggable from inside (#1620)

This commit is contained in:
Preet 2020-05-21 12:57:54 -07:00 committed by GitHub
parent c427aa3cce
commit 584e4182a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 11 deletions

View File

@ -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];

View File

@ -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}`);
}