diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/store.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/store.js index 90cfb7d24..0c43446bf 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/store.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/store.js @@ -1,6 +1,6 @@ import { createStore } from 'vuex' import { getHouseholdByPerson, getCoursesByPerson, getRelationshipsByPerson } from './api' -import { adapt2vis, getHouseholdLabel, getHouseholdWidth, getRelationshipLabel, getRelationshipTitle, splitId } from './vis-network' +import { adapt2vis, getHouseholdLabel, getHouseholdWidth, getRelationshipLabel, getRelationshipTitle, getRelationshipDirection, splitId } from './vis-network' const debug = process.env.NODE_ENV !== 'production' @@ -291,7 +291,7 @@ const store = createStore({ from: `person_${r.fromPerson.id}`, to: `person_${r.toPerson.id}`, id: 'r' + splitId(r.id,'id') + '_p' + r.fromPerson.id + '_p' + r.toPerson.id, - arrows: 'to', + arrows: getRelationshipDirection(r), color: 'lightblue', font: { color: '#33839d' }, dashes: true, //physics: false, diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/vis-network.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/vis-network.js index 3a12265d6..920a92ed1 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/vis-network.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/vis-network.js @@ -289,14 +289,23 @@ const getHouseholdWidth = (member) => { return 1 } +/** + * Return direction edge + * @param relationship + * @returns string + */ +const getRelationshipDirection = (relationship) => { + return (!relationship.reverse) ? 'to' : 'from' +} + /** * Return label edge + * !! always set label in title direction (arrow is reversed, see in previous method) !! * @param relationship * @returns string */ const getRelationshipLabel = (relationship) => { - return (!relationship.reverse) ? - relationship.relation.title.fr : relationship.relation.reverseTitle.fr + return relationship.relation.title.fr } /** @@ -331,6 +340,7 @@ export { adapt2vis, getHouseholdLabel, getHouseholdWidth, + getRelationshipDirection, getRelationshipLabel, getRelationshipTitle, splitId