File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -243,7 +243,17 @@ var PacketPlayer = (function () {
243243 this . easingImpl = ( ( ) => {
244244 return ( start , end , percent ) => {
245245 if ( curve . ctrlpts ) {
246- let middle = ( start == curve . startX || start == curve . endX ) ? curve . ctrlpts [ 0 ] : curve . ctrlpts [ 1 ] ;
246+ // Cytoscape animates in MODEL coordinates, not rendered coordinates
247+ // Check if we're animating X or Y coordinate by comparing with curve coordinates
248+ const tolerance = 0.01 ;
249+ const isClose = ( a , b ) => Math . abs ( a - b ) < tolerance ;
250+
251+ let isXAnimation =
252+ isClose ( start , curve . startX ) || isClose ( end , curve . startX ) ||
253+ isClose ( start , curve . endX ) || isClose ( end , curve . endX ) ;
254+
255+ let middle = isXAnimation ? curve . ctrlpts [ 0 ] : curve . ctrlpts [ 1 ] ;
256+
247257 return ( 1 - percent ) * ( 1 - percent ) * start + 2 * ( percent ) * ( 1 - percent ) * ( middle ) + percent * percent * end
248258 } else {
249259 return start + ( end - start ) * percent ;
You can’t perform that action at this time.
0 commit comments