-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
100 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
packages/mermaid/src/rendering-util/rendering-elements/shapes/roundedRectPath.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
export const createRoundedRectPathD = ( | ||
x: number, | ||
y: number, | ||
totalWidth: number, | ||
totalHeight: number, | ||
radius: number | ||
) => | ||
[ | ||
'M', | ||
x + radius, | ||
y, // Move to the first point | ||
'H', | ||
x + totalWidth - radius, // Draw horizontal line to the beginning of the right corner | ||
'A', | ||
radius, | ||
radius, | ||
0, | ||
0, | ||
1, | ||
x + totalWidth, | ||
y + radius, // Draw arc to the right top corner | ||
'V', | ||
y + totalHeight - radius, // Draw vertical line down to the beginning of the right bottom corner | ||
'A', | ||
radius, | ||
radius, | ||
0, | ||
0, | ||
1, | ||
x + totalWidth - radius, | ||
y + totalHeight, // Draw arc to the right bottom corner | ||
'H', | ||
x + radius, // Draw horizontal line to the beginning of the left bottom corner | ||
'A', | ||
radius, | ||
radius, | ||
0, | ||
0, | ||
1, | ||
x, | ||
y + totalHeight - radius, // Draw arc to the left bottom corner | ||
'V', | ||
y + radius, // Draw vertical line up to the beginning of the left top corner | ||
'A', | ||
radius, | ||
radius, | ||
0, | ||
0, | ||
1, | ||
x + radius, | ||
y, // Draw arc to the left top corner | ||
'Z', // Close the path | ||
].join(' '); |