@@ -6,7 +6,7 @@ import BBoxHelper from "src/utils/bbox-helper"
66import CanvasHelper from "src/utils/canvas-helper"
77
88export default class EdgePathfindingSquare extends EdgePathfindingMethod {
9- getPath ( _plugin : AdvancedCanvasPlugin , _canvas : Canvas , fromPos : Position , fromSide : Side , toPos : Position , toSide : Side , _isDragging : boolean ) : EdgePath {
9+ getPath ( _plugin : AdvancedCanvasPlugin , _canvas : Canvas , fromPos : Position , fromBBoxSidePos : Position , fromSide : Side , toPos : Position , toBBoxSidePos : Position , toSide : Side , _isDragging : boolean ) : EdgePath {
1010 let pathArray : Position [ ] = [ ]
1111
1212 if ( fromSide === toSide ) {
@@ -16,15 +16,15 @@ export default class EdgePathfindingSquare extends EdgePathfindingMethod {
1616 if ( BBoxHelper . isHorizontal ( fromSide ) ) {
1717 pathArray = [
1818 fromPos ,
19- { x : Math . max ( fromPos . x , toPos . x ) + direction * CanvasHelper . GRID_SIZE , y : fromPos . y } ,
20- { x : Math . max ( fromPos . x , toPos . x ) + direction * CanvasHelper . GRID_SIZE , y : toPos . y } ,
19+ { x : Math . max ( fromBBoxSidePos . x , toBBoxSidePos . x ) + direction * CanvasHelper . GRID_SIZE , y : fromBBoxSidePos . y } ,
20+ { x : Math . max ( fromBBoxSidePos . x , toBBoxSidePos . x ) + direction * CanvasHelper . GRID_SIZE , y : toBBoxSidePos . y } ,
2121 toPos
2222 ]
2323 } else {
2424 pathArray = [
2525 fromPos ,
26- { x : fromPos . x , y : Math . max ( fromPos . y , toPos . y ) + direction * CanvasHelper . GRID_SIZE } ,
27- { x : toPos . x , y : Math . max ( fromPos . y , toPos . y ) + direction * CanvasHelper . GRID_SIZE } ,
26+ { x : fromBBoxSidePos . x , y : Math . max ( fromBBoxSidePos . y , toBBoxSidePos . y ) + direction * CanvasHelper . GRID_SIZE } ,
27+ { x : toBBoxSidePos . x , y : Math . max ( fromBBoxSidePos . y , toBBoxSidePos . y ) + direction * CanvasHelper . GRID_SIZE } ,
2828 toPos
2929 ]
3030 }
@@ -33,15 +33,15 @@ export default class EdgePathfindingSquare extends EdgePathfindingMethod {
3333 if ( BBoxHelper . isHorizontal ( fromSide ) ) {
3434 pathArray = [
3535 fromPos ,
36- { x : fromPos . x + ( toPos . x - fromPos . x ) / 2 , y : fromPos . y } ,
37- { x : fromPos . x + ( toPos . x - fromPos . x ) / 2 , y : toPos . y } ,
36+ { x : fromBBoxSidePos . x + ( toBBoxSidePos . x - fromBBoxSidePos . x ) / 2 , y : fromBBoxSidePos . y } ,
37+ { x : fromBBoxSidePos . x + ( toBBoxSidePos . x - fromBBoxSidePos . x ) / 2 , y : toBBoxSidePos . y } ,
3838 toPos
3939 ]
4040 } else {
4141 pathArray = [
4242 fromPos ,
43- { x : fromPos . x , y : fromPos . y + ( toPos . y - fromPos . y ) / 2 } ,
44- { x : toPos . x , y : fromPos . y + ( toPos . y - fromPos . y ) / 2 } ,
43+ { x : fromBBoxSidePos . x , y : fromBBoxSidePos . y + ( toBBoxSidePos . y - fromBBoxSidePos . y ) / 2 } ,
44+ { x : toBBoxSidePos . x , y : fromBBoxSidePos . y + ( toBBoxSidePos . y - fromBBoxSidePos . y ) / 2 } ,
4545 toPos
4646 ]
4747 }
@@ -50,13 +50,13 @@ export default class EdgePathfindingSquare extends EdgePathfindingMethod {
5050 if ( BBoxHelper . isHorizontal ( fromSide ) ) {
5151 pathArray = [
5252 fromPos ,
53- { x : toPos . x , y : fromPos . y } ,
53+ { x : toBBoxSidePos . x , y : fromBBoxSidePos . y } ,
5454 toPos
5555 ]
5656 } else {
5757 pathArray = [
5858 fromPos ,
59- { x : fromPos . x , y : toPos . y } ,
59+ { x : fromBBoxSidePos . x , y : toBBoxSidePos . y } ,
6060 toPos
6161 ]
6262 }
@@ -65,8 +65,8 @@ export default class EdgePathfindingSquare extends EdgePathfindingMethod {
6565 return {
6666 svgPath : SvgPathHelper . pathArrayToSvgPath ( pathArray , false ) ,
6767 center : {
68- x : ( fromPos . x + toPos . x ) / 2 ,
69- y : ( fromPos . y + toPos . y ) / 2
68+ x : ( fromBBoxSidePos . x + toBBoxSidePos . x ) / 2 ,
69+ y : ( fromBBoxSidePos . y + toBBoxSidePos . y ) / 2
7070 } ,
7171 rotateArrows : false
7272 }
0 commit comments