Skip to content

Fix/arrow content on straight arrow #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/witty-seals-punch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"slidev-addon-fancy-arrow": patch
---

Fix to display the contents on straight arrows
4 changes: 4 additions & 0 deletions components/use-rough-arrow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ export function useRoughArrow(props: {
angle1: angle,
angle2: angle,
lineLength: Math.hypot(point2.x - point1.x, point2.y - point1.y),
arcMid: {
x: (point1.x + point2.x) / 2,
y: (point1.y + point2.y) / 2,
},
};
}

Expand Down
43 changes: 43 additions & 0 deletions slides.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,49 @@ Use `pos1` and `pos2` to specify the anchor point on the snapped elements.

</div>

---

# Content on the arrow

<FancyArrow x1="100" y1="100" x2="200" y2="200" >
Hello
</FancyArrow>

<FancyArrow x1="200" y1="100" x2="300" y2="200" arc="0.3">
Ahoy
</FancyArrow>

<FancyArrow x1="300" y1="100" x2="400" y2="200" arc="0.3">
<span text-4xl text-red>Hello</span>
</FancyArrow>

<FancyArrow x1="400" y1="100" x2="500" y2="200" arc="0.3">
<span text-nowrap>Slidev logo</span>
<img src="https://sli.dev/logo.svg" w-10 m-auto/>
</FancyArrow>

<div mt-40>

```html
<FancyArrow x1="100" y1="100" x2="200" y2="200" >
Hello
</FancyArrow>

<FancyArrow x1="200" y1="100" x2="300" y2="200" arc="0.3">
Ahoy
</FancyArrow>

<FancyArrow x1="300" y1="100" x2="400" y2="200" arc="0.3">
<span text-4xl text-red>Hello</span>
</FancyArrow>

<FancyArrow x1="400" y1="100" x2="500" y2="200" arc="0.3">
<span text-nowrap>Slidev logo</span>
<img src="https://sli.dev/logo.svg" w-10 m-auto/>
</FancyArrow>
```

</div>

---

Expand Down