File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -756,8 +756,8 @@ export function createSmoothPath(points) {
756756 if ( slopes [ i - 1 ] * slopes [ i ] <= 0 ) {
757757 tangents [ i ] = 0 ;
758758 } else {
759- const commonSlope = ( slopes [ i - 1 ] + slopes [ i ] ) / 2 ;
760- tangents [ i ] = Math . min ( Math . abs ( commonSlope ) , Math . abs ( slopes [ i - 1 ] ) , Math . abs ( slopes [ i ] ) ) * Math . sign ( commonSlope ) ;
759+ const harmonicMean = ( 2 * slopes [ i - 1 ] * slopes [ i ] ) / ( slopes [ i - 1 ] + slopes [ i ] ) ;
760+ tangents [ i ] = harmonicMean ;
761761 }
762762 }
763763
@@ -766,10 +766,8 @@ export function createSmoothPath(points) {
766766 const y1 = points [ i ] . y ;
767767 const x2 = points [ i + 1 ] . x ;
768768 const y2 = points [ i + 1 ] . y ;
769-
770769 const m1 = tangents [ i ] ;
771770 const m2 = tangents [ i + 1 ] ;
772-
773771 const controlX1 = x1 + ( x2 - x1 ) / 3 ;
774772 const controlY1 = y1 + m1 * ( x2 - x1 ) / 3 ;
775773 const controlX2 = x2 - ( x2 - x1 ) / 3 ;
@@ -781,6 +779,7 @@ export function createSmoothPath(points) {
781779 return path . join ( ' ' ) ;
782780}
783781
782+
784783export function createUid ( ) {
785784 return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
786785 . replace ( / [ x y ] / g, function ( c ) {
You can’t perform that action at this time.
0 commit comments