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 { createStore } from 'vuex'
|
||||||
import { getHouseholdByPerson, getCoursesByPerson, getRelationshipsByPerson } from './api'
|
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'
|
const debug = process.env.NODE_ENV !== 'production'
|
||||||
|
|
||||||
@ -291,7 +291,7 @@ const store = createStore({
|
|||||||
from: `person_${r.fromPerson.id}`,
|
from: `person_${r.fromPerson.id}`,
|
||||||
to: `person_${r.toPerson.id}`,
|
to: `person_${r.toPerson.id}`,
|
||||||
id: 'r' + splitId(r.id,'id') + '_p' + r.fromPerson.id + '_p' + r.toPerson.id,
|
id: 'r' + splitId(r.id,'id') + '_p' + r.fromPerson.id + '_p' + r.toPerson.id,
|
||||||
arrows: 'to',
|
arrows: getRelationshipDirection(r),
|
||||||
color: 'lightblue',
|
color: 'lightblue',
|
||||||
font: { color: '#33839d' },
|
font: { color: '#33839d' },
|
||||||
dashes: true, //physics: false,
|
dashes: true, //physics: false,
|
||||||
|
@ -289,14 +289,23 @@ const getHouseholdWidth = (member) => {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return direction edge
|
||||||
|
* @param relationship
|
||||||
|
* @returns string
|
||||||
|
*/
|
||||||
|
const getRelationshipDirection = (relationship) => {
|
||||||
|
return (!relationship.reverse) ? 'to' : 'from'
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return label edge
|
* Return label edge
|
||||||
|
* !! always set label in title direction (arrow is reversed, see in previous method) !!
|
||||||
* @param relationship
|
* @param relationship
|
||||||
* @returns string
|
* @returns string
|
||||||
*/
|
*/
|
||||||
const getRelationshipLabel = (relationship) => {
|
const getRelationshipLabel = (relationship) => {
|
||||||
return (!relationship.reverse) ?
|
return relationship.relation.title.fr
|
||||||
relationship.relation.title.fr : relationship.relation.reverseTitle.fr
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -331,6 +340,7 @@ export {
|
|||||||
adapt2vis,
|
adapt2vis,
|
||||||
getHouseholdLabel,
|
getHouseholdLabel,
|
||||||
getHouseholdWidth,
|
getHouseholdWidth,
|
||||||
|
getRelationshipDirection,
|
||||||
getRelationshipLabel,
|
getRelationshipLabel,
|
||||||
getRelationshipTitle,
|
getRelationshipTitle,
|
||||||
splitId
|
splitId
|
||||||
|
Loading…
x
Reference in New Issue
Block a user