mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Add free draw mode (#1570)
This commit is contained in:
parent
36e0c439fb
commit
9ec43d2626
21 changed files with 344 additions and 49 deletions
|
@ -11,6 +11,7 @@ export const SHAPES = [
|
|||
</svg>
|
||||
),
|
||||
value: "selection",
|
||||
key: "s",
|
||||
},
|
||||
{
|
||||
icon: (
|
||||
|
@ -20,6 +21,7 @@ export const SHAPES = [
|
|||
</svg>
|
||||
),
|
||||
value: "rectangle",
|
||||
key: "r",
|
||||
},
|
||||
{
|
||||
icon: (
|
||||
|
@ -29,6 +31,7 @@ export const SHAPES = [
|
|||
</svg>
|
||||
),
|
||||
value: "diamond",
|
||||
key: "d",
|
||||
},
|
||||
{
|
||||
icon: (
|
||||
|
@ -38,6 +41,7 @@ export const SHAPES = [
|
|||
</svg>
|
||||
),
|
||||
value: "ellipse",
|
||||
key: "e",
|
||||
},
|
||||
{
|
||||
icon: (
|
||||
|
@ -47,6 +51,7 @@ export const SHAPES = [
|
|||
</svg>
|
||||
),
|
||||
value: "arrow",
|
||||
key: "a",
|
||||
},
|
||||
{
|
||||
icon: (
|
||||
|
@ -63,6 +68,20 @@ export const SHAPES = [
|
|||
</svg>
|
||||
),
|
||||
value: "line",
|
||||
key: "l",
|
||||
},
|
||||
{
|
||||
icon: (
|
||||
// fa-pencil
|
||||
<svg viewBox="0 0 512 512">
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M290.74 93.24l128.02 128.02-277.99 277.99-114.14 12.6C11.35 513.54-1.56 500.62.14 485.34l12.7-114.22 277.9-277.88zm207.2-19.06l-60.11-60.11c-18.75-18.75-49.16-18.75-67.91 0l-56.55 56.55 128.02 128.02 56.55-56.55c18.75-18.76 18.75-49.16 0-67.91z"
|
||||
></path>
|
||||
</svg>
|
||||
),
|
||||
value: "draw",
|
||||
key: "x",
|
||||
},
|
||||
{
|
||||
icon: (
|
||||
|
@ -72,20 +91,19 @@ export const SHAPES = [
|
|||
</svg>
|
||||
),
|
||||
value: "text",
|
||||
key: "t",
|
||||
},
|
||||
] as const;
|
||||
|
||||
export const shapesShortcutKeys = SHAPES.map((shape, index) => [
|
||||
shape.value[0],
|
||||
shape.key,
|
||||
(index + 1).toString(),
|
||||
]).flat(1);
|
||||
|
||||
export function findShapeByKey(key: string) {
|
||||
return (
|
||||
SHAPES.find((shape, index) => {
|
||||
return (
|
||||
shape.value[0] === key.toLowerCase() || key === (index + 1).toString()
|
||||
);
|
||||
return shape.key === key.toLowerCase() || key === (index + 1).toString();
|
||||
})?.value || "selection"
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue