This repository was archived by the owner on Jul 29, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
lib/network/modules/components/edges Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -133,8 +133,16 @@ class BezierEdgeDynamic extends BezierEdgeBase {
133
133
*/
134
134
getPoint ( percentage , viaNode = this . via ) {
135
135
let t = percentage ;
136
- let x = Math . pow ( 1 - t , 2 ) * this . fromPoint . x + ( 2 * t * ( 1 - t ) ) * viaNode . x + Math . pow ( t , 2 ) * this . toPoint . x ;
137
- let y = Math . pow ( 1 - t , 2 ) * this . fromPoint . y + ( 2 * t * ( 1 - t ) ) * viaNode . y + Math . pow ( t , 2 ) * this . toPoint . y ;
136
+ let x , y ;
137
+ if ( this . from === this . to ) {
138
+ let [ cx , cy , cr ] = this . _getCircleData ( this . from )
139
+ let a = 2 * Math . PI * ( 1 - t ) ;
140
+ x = cx + cr * Math . sin ( a ) ;
141
+ y = cy + cr - cr * ( 1 - Math . cos ( a ) ) ;
142
+ } else {
143
+ x = Math . pow ( 1 - t , 2 ) * this . fromPoint . x + 2 * t * ( 1 - t ) * viaNode . x + Math . pow ( t , 2 ) * this . toPoint . x ;
144
+ y = Math . pow ( 1 - t , 2 ) * this . fromPoint . y + 2 * t * ( 1 - t ) * viaNode . y + Math . pow ( t , 2 ) * this . toPoint . y ;
145
+ }
138
146
139
147
return { x : x , y : y } ;
140
148
}
@@ -151,4 +159,4 @@ class BezierEdgeDynamic extends BezierEdgeBase {
151
159
}
152
160
153
161
154
- export default BezierEdgeDynamic ;
162
+ export default BezierEdgeDynamic ;
You can’t perform that action at this time.
0 commit comments