@@ -14,13 +14,24 @@ const crossShift = 2;
1414const ICONS_DIR = 'resources/' ;
1515
1616// Arrow can go from top ot bottom of file icon
17- const getSourcePt = ( groupName , sourcePosition ) => ( {
18- x : sourcePosition . x + 11 ,
19- y : [ TOP_LEFT , TOP_RIGHT ] . includes ( groupName ) ? sourcePosition . y + 6 : sourcePosition . y - 6
20- } ) ;
17+ const getSourcePt = ( groupName , sourcePosition , targetPt ) => {
18+ const topDirection =
19+ sourcePosition . y !== targetPt . y ? [ TOP_LEFT , TOP_RIGHT ] . includes ( groupName ) : true ;
20+
21+ return {
22+ x : sourcePosition . x + 11 ,
23+ y : topDirection ? sourcePosition . y + 6 : sourcePosition . y - 6
24+ } ;
25+ } ;
26+
27+ const getSourceDotLinePoints = ( groupName , sourcePt , sourcePosition , targetPosition ) => {
28+ const shiftY =
29+ sourcePosition . y !== targetPosition . y
30+ ? [ TOP_LEFT , TOP_RIGHT ] . includes ( groupName )
31+ ? 1
32+ : - 1
33+ : 1 ;
2134
22- const getSourceDotLinePoints = ( groupName , sourcePt ) => {
23- const shiftY = [ TOP_LEFT , TOP_RIGHT ] . includes ( groupName ) ? 1 : - 1 ;
2435 return [
2536 [ sourcePt . x - 2 , sourcePt . y - shiftY ] ,
2637 [ sourcePt . x , sourcePt . y + shiftY ] ,
@@ -86,8 +97,13 @@ export const DependenciesEdge = props => {
8697 } = props ;
8798
8899 //TODO: replace groupName with direction boolean if no need for sides
89- const sourcePt = getSourcePt ( groupName , sourcePosition ) ;
90- const sourceDotLinePoints = getSourceDotLinePoints ( groupName , sourcePt ) ;
100+ const sourcePt = getSourcePt ( groupName , sourcePosition , targetPosition ) ;
101+ const sourceDotLinePoints = getSourceDotLinePoints (
102+ groupName ,
103+ sourcePt ,
104+ sourcePosition ,
105+ targetPosition
106+ ) ;
91107 const connectionLinePoints = ! firstSourcePosition
92108 ? getConnectionLine ( groupName , targetPosition , sourcePosition , sourcePt )
93109 : getConnectionLineToFirstSource (
@@ -155,7 +171,7 @@ const getOverlappingConnectionLine = (groupName, targetPosition, sourcePosition)
155171export const DependenciesOverlappingEdge = props => {
156172 const { groupName, targetPosition, sourcePosition, selected, onClick } = props ;
157173
158- const sourcePt = getSourcePt ( groupName , sourcePosition ) ;
174+ const sourcePt = getSourcePt ( groupName , sourcePosition , targetPosition ) ;
159175 const connectionLinePoints = getOverlappingConnectionLine (
160176 groupName ,
161177 targetPosition ,
0 commit comments