mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
visgraph: with reversed relationship, reverse arrow and not title
This commit is contained in:
parent
58f7715643
commit
6c52233a5a
@ -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,
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user