mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Extract available shapes to one place
This commit is contained in:
parent
ad91f39787
commit
4626d0d21d
1 changed files with 26 additions and 5 deletions
|
@ -479,6 +479,29 @@ const KEYS = {
|
||||||
BACKSPACE: "Backspace"
|
BACKSPACE: "Backspace"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const SHAPES = [
|
||||||
|
{
|
||||||
|
label: "Rectange",
|
||||||
|
value: "rectangle"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Ellipse",
|
||||||
|
value: "ellipse"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Arrow",
|
||||||
|
value: "arrow"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Text",
|
||||||
|
value: "text"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Selection",
|
||||||
|
value: "selection"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
function isArrowKey(keyCode: string) {
|
function isArrowKey(keyCode: string) {
|
||||||
return (
|
return (
|
||||||
keyCode === KEYS.ARROW_LEFT ||
|
keyCode === KEYS.ARROW_LEFT ||
|
||||||
|
@ -619,11 +642,9 @@ class App extends React.Component<{}, AppState> {
|
||||||
>
|
>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Shapes</legend>
|
<legend>Shapes</legend>
|
||||||
{this.renderOption({ type: "rectangle", children: "Rectangle" })}
|
{SHAPES.map(shape =>
|
||||||
{this.renderOption({ type: "ellipse", children: "Ellipse" })}
|
this.renderOption({ type: shape.value, children: shape.label })
|
||||||
{this.renderOption({ type: "arrow", children: "Arrow" })}
|
)}
|
||||||
{this.renderOption({ type: "text", children: "Text" })}
|
|
||||||
{this.renderOption({ type: "selection", children: "Selection" })}
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<canvas
|
<canvas
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue