From 8d8769ba4ec8f002bcc8061872f1f5a712898984 Mon Sep 17 00:00:00 2001 From: Jonas Bleyl Date: Wed, 27 Oct 2021 18:27:39 +0100 Subject: [PATCH] feat: add triangle arrowhead (#4024) Co-authored-by: ad1992 Co-authored-by: dwelle --- src/actions/actionProperties.tsx | 17 +++++++++++++++++ src/components/IconPicker.scss | 2 +- src/components/icons.tsx | 15 +++++++++++++++ src/element/bounds.ts | 2 ++ src/element/types.ts | 2 +- src/locales/en.json | 1 + src/renderer/renderElement.ts | 23 +++++++++++++++++++++++ 7 files changed, 60 insertions(+), 2 deletions(-) diff --git a/src/actions/actionProperties.tsx b/src/actions/actionProperties.tsx index 667a68fcb..cc3bbbdba 100644 --- a/src/actions/actionProperties.tsx +++ b/src/actions/actionProperties.tsx @@ -6,6 +6,7 @@ import { ArrowheadArrowIcon, ArrowheadBarIcon, ArrowheadDotIcon, + ArrowheadTriangleIcon, ArrowheadNoneIcon, EdgeRoundIcon, EdgeSharpIcon, @@ -738,6 +739,14 @@ export const actionChangeArrowhead = register({ icon: , keyBinding: "r", }, + { + value: "triangle", + text: t("labels.arrowhead_triangle"), + icon: ( + + ), + keyBinding: "t", + }, ]} value={getFormValue( elements, @@ -780,6 +789,14 @@ export const actionChangeArrowhead = register({ keyBinding: "r", icon: , }, + { + value: "triangle", + text: t("labels.arrowhead_triangle"), + icon: ( + + ), + keyBinding: "t", + }, ]} value={getFormValue( elements, diff --git a/src/components/IconPicker.scss b/src/components/IconPicker.scss index 0bf0b1bc3..c02416600 100644 --- a/src/components/IconPicker.scss +++ b/src/components/IconPicker.scss @@ -90,7 +90,7 @@ .picker-content { padding: 0.5rem; display: grid; - grid-auto-flow: column; + grid-template-columns: repeat(3, auto); grid-gap: 0.5rem; border-radius: 4px; :root[dir="rtl"] & { diff --git a/src/components/icons.tsx b/src/components/icons.tsx index fb1f5772d..3f954c90e 100644 --- a/src/components/icons.tsx +++ b/src/components/icons.tsx @@ -752,6 +752,21 @@ export const ArrowheadBarIcon = React.memo( ), ); +export const ArrowheadTriangleIcon = React.memo( + ({ theme, flip = false }: { theme: Theme; flip?: boolean }) => + createIcon( + + + + , + { width: 40, height: 20 }, + ), +); + export const FontSizeSmallIcon = React.memo(({ theme }: { theme: Theme }) => createIcon(