mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Add Arrowheads to Arrows (#2452)
Co-authored-by: dwelle <luzar.david@gmail.com> Co-authored-by: Lipis <lipiridis@gmail.com>
This commit is contained in:
parent
bd8e860d7f
commit
c291edfc44
25 changed files with 711 additions and 101 deletions
|
@ -2576,6 +2576,14 @@ class App extends React.Component<ExcalidrawProps, AppState> {
|
|||
pointerDownState.origin.y,
|
||||
elementType === "draw" ? null : this.state.gridSize,
|
||||
);
|
||||
|
||||
// If arrow is pre-arrowheads, it will have undefined for both start and end arrowheads.
|
||||
// If so, we want it to be null/"arrow". If the linear item is not an arrow, we want it
|
||||
// to be null/null. Otherwise, we want it to use the currentItemArrowheads values.
|
||||
const { start, end } = this.state.currentItemArrowheads;
|
||||
const [startArrowhead, endArrowhead] =
|
||||
elementType === "arrow" ? [start, end] : [null, null];
|
||||
|
||||
const element = newLinearElement({
|
||||
type: elementType,
|
||||
x: gridX,
|
||||
|
@ -2588,6 +2596,8 @@ class App extends React.Component<ExcalidrawProps, AppState> {
|
|||
roughness: this.state.currentItemRoughness,
|
||||
opacity: this.state.currentItemOpacity,
|
||||
strokeSharpness: this.state.currentItemLinearStrokeSharpness,
|
||||
startArrowhead,
|
||||
endArrowhead,
|
||||
});
|
||||
this.setState((prevState) => ({
|
||||
selectedElementIds: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue