Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit610d33b

Browse files
Added Self loop transitions
1 parent246adb6 commit610d33b

File tree

5 files changed

+36
-4
lines changed

5 files changed

+36
-4
lines changed

‎index.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<htmllang="en">
33
<head>
44
<metacharset="UTF-8"/>
5-
<linkrel="icon"type="image/svg+xml"href="/vite.svg"/>
5+
<linkrel="icon"type="image/svg+xml"href="/fsm-engine.svg"/>
66
<metaname="viewport"content="width=device-width, initial-scale=1.0"/>
77
<title>FSM Engine</title>
88
</head>

‎public/fsm-engine.svg‎

Lines changed: 15 additions & 0 deletions
Loading

‎public/vite.svg‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎src/assets/react.svg‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎src/components/Editor.tsx‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ const Editor = () => {
8585
stroke:"#ffffffe6",
8686
strokeWidth:2,
8787
fill:"#ffffffe6",
88+
tension:transitionTracker==id ?1 :0.5,
8889
};
8990

9091
transitions.push(newTransition);
@@ -165,6 +166,24 @@ const Editor = () => {
165166

166167
// Generate Points for drawing transition arrow
167168
functiongetPoints(id1,id2){
169+
170+
if(id1==id2){
171+
// Self-loop
172+
constnode=layerRef.current.findOne(`#g${id1}`);
173+
constx=node.x();
174+
consty=node.y();
175+
constradius=node.children[0].radius();
176+
constoffset=30;
177+
178+
constpoints=[
179+
x-radius/1.5,y-radius,// Start point (left of the node)
180+
x,y-radius-2*offset,// Control point (top)
181+
x+radius/1.5,y-radius,// End point (right of the node)
182+
];
183+
184+
returnpoints;
185+
}
186+
168187
constclickedGroup=layerRef.current.findOne(`#g${id2}`);
169188

170189
conststartNode=layerRef.current.findOne(`#g${id1}`);
@@ -286,7 +305,7 @@ const Editor = () => {
286305
strokeWidth={transition.strokeWidth}
287306
fill={transition.fill}
288307
points={transition.points}
289-
tension={0.5}
308+
tension={transition.tension}
290309
/>
291310
))}
292311
</Group>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp