@@ -48,7 +48,11 @@ export const generateElbowLineRoute = (options: ElbowLineRouteOptions, board?: P
4848 const isHitY = RectangleClient . isHitY ( options . sourceOuterRectangle , options . targetOuterRectangle ) ;
4949 const centerX = isHitX ? undefined : RectangleClient . getGapCenter ( options . sourceOuterRectangle , options . targetOuterRectangle , true ) ;
5050 const centerY = isHitY ? undefined : RectangleClient . getGapCenter ( options . sourceOuterRectangle , options . targetOuterRectangle , false ) ;
51- route = routeAdjust ( route , { centerX, centerY, sourceRectangle : options . sourceRectangle , targetRectangle : options . targetRectangle } , board ) ;
51+ route = routeAdjust (
52+ route ,
53+ { centerX, centerY, sourceRectangle : options . sourceRectangle , targetRectangle : options . targetRectangle } ,
54+ board
55+ ) ;
5256 return route ;
5357} ;
5458
@@ -61,7 +65,11 @@ export const routeAdjust = (path: Point[], options: RouteAdjustOptions, board?:
6165 const optionsX = getAdjustOptions ( path , centerX , true ) ;
6266 const resultX =
6367 optionsX . pointOfHit &&
64- adjust ( path , { parallelPaths : optionsX . parallelPaths , pointOfHit : optionsX . pointOfHit , sourceRectangle, targetRectangle } , board ) ;
68+ adjust (
69+ path ,
70+ { parallelPaths : optionsX . parallelPaths , pointOfHit : optionsX . pointOfHit , sourceRectangle, targetRectangle } ,
71+ board
72+ ) ;
6573 if ( resultX ) {
6674 path = resultX ;
6775 }
@@ -70,7 +78,11 @@ export const routeAdjust = (path: Point[], options: RouteAdjustOptions, board?:
7078 const optionsY = getAdjustOptions ( path , centerY , false ) ;
7179 const resultY =
7280 optionsY . pointOfHit &&
73- adjust ( path , { parallelPaths : optionsY . parallelPaths , pointOfHit : optionsY . pointOfHit , sourceRectangle, targetRectangle } , board ) ;
81+ adjust (
82+ path ,
83+ { parallelPaths : optionsY . parallelPaths , pointOfHit : optionsY . pointOfHit , sourceRectangle, targetRectangle } ,
84+ board
85+ ) ;
7486 if ( resultY ) {
7587 path = resultY ;
7688 }
@@ -81,7 +93,7 @@ export const routeAdjust = (path: Point[], options: RouteAdjustOptions, board?:
8193const adjust = ( route : Point [ ] , options : AdjustOptions , board ?: PlaitBoard ) : null | Point [ ] => {
8294 const { parallelPaths, pointOfHit, sourceRectangle, targetRectangle } = options ;
8395 let result = null ;
84- parallelPaths . forEach ( parallelPath => {
96+ parallelPaths . forEach ( ( parallelPath ) => {
8597 // Construct a rectangle
8698 const tempRectPoints = [ pointOfHit , parallelPath [ 0 ] , parallelPath [ 1 ] ] ;
8799 // directly use getCornerPoints will bring the precision issue (eg: 263.6923375175286 - 57.130859375)
@@ -94,7 +106,7 @@ const adjust = (route: Point[], options: AdjustOptions, board?: PlaitBoard): nul
94106 const indexRangeInPath : number [ ] = [ ] ;
95107 const indexRangeInCorner : number [ ] = [ ] ;
96108 route . forEach ( ( point , index ) => {
97- const cornerResult = tempCorners . findIndex ( corner => Point . isEquals ( point , corner ) ) ;
109+ const cornerResult = tempCorners . findIndex ( ( corner ) => Point . isEquals ( point , corner ) ) ;
98110 if ( cornerResult !== - 1 ) {
99111 indexRangeInPath . push ( index ) ;
100112 indexRangeInCorner . push ( cornerResult ) ;
@@ -153,7 +165,7 @@ export const getGraphPoints = (options: ElbowLineRouteOptions) => {
153165 const y : number [ ] = [ ] ;
154166 let result : Point [ ] = [ ] ;
155167
156- [ sourceOuterRectangle , targetOuterRectangle ] . forEach ( rectangle => {
168+ [ sourceOuterRectangle , targetOuterRectangle ] . forEach ( ( rectangle ) => {
157169 x . push ( rectangle . x , rectangle . x + rectangle . width / 2 , rectangle . x + rectangle . width ) ;
158170 y . push ( rectangle . y , rectangle . y + rectangle . height / 2 , rectangle . y + rectangle . height ) ;
159171 } ) ;
@@ -181,7 +193,7 @@ export const getGraphPoints = (options: ElbowLineRouteOptions) => {
181193 }
182194 }
183195 }
184- result = removeDuplicatePoints ( result ) . filter ( point => {
196+ result = removeDuplicatePoints ( result ) . filter ( ( point ) => {
185197 const isInSource = RectangleClient . isPointInRectangle ( sourceOuterRectangle , point ) ;
186198 const isInTarget = RectangleClient . isPointInRectangle ( targetOuterRectangle , point ) ;
187199 return ! isInSource && ! isInTarget ;
@@ -193,7 +205,7 @@ export const createGraph = (points: Point[]) => {
193205 const graph = new PointGraph ( ) ;
194206 const Xs : number [ ] = [ ] ;
195207 const Ys : number [ ] = [ ] ;
196- points . forEach ( p => {
208+ points . forEach ( ( p ) => {
197209 const x = p [ 0 ] ,
198210 y = p [ 1 ] ;
199211 if ( Xs . indexOf ( x ) < 0 ) Xs . push ( x ) ;
0 commit comments