Skip to content

Commit ae21729

Browse files
Dep edge fixes
1 parent 6e750ff commit ae21729

5 files changed

Lines changed: 34 additions & 20 deletions

File tree

‎example-project/index.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import getStore from 'store/createStore';
1010
const MOUNT_NODE_ID = 'mount-node';
1111

1212
const { store, persistor } = getStore();
13-
//cc:#one#1;here
1413
ReactDOM.render(
1514
<Provider store={store}>
1615
<PersistGate loading={null} persistor={persistor}>

‎example-project/store/createStore.js‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import viewSwitches from 'components/controls/ViewSwitches/store/reducer';
88
import dataBus from 'components/dataBus/store/reducer';
99
import rootSaga from './sagas';
1010

11-
//cc:#one#0;pesist;
12-
1311
export default () => {
1412
const sagaMiddleware = createSagaMiddleware();
1513
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

‎src/public/dist/bundle.js‎

Lines changed: 8 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/public/dist/bundle.js.map‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/public/js/components/treeDiagram/component/Edge/DepenenciesEdge.js‎

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,24 @@ const crossShift = 2;
1414
const 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)
155171
export 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

Comments
 (0)