mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
listen on relationship nodes event (wip)
This commit is contained in:
parent
e55e8e072d
commit
2c0198ef78
@ -234,14 +234,13 @@ export default {
|
|||||||
},
|
},
|
||||||
listenOnGraph() {
|
listenOnGraph() {
|
||||||
window.network.on('selectNode', (data) => {
|
window.network.on('selectNode', (data) => {
|
||||||
|
|
||||||
if (data.nodes.length > 1) {
|
if (data.nodes.length > 1) {
|
||||||
throw 'Multi selection is not allowed. Disable it in options.interaction !'
|
throw 'Multi selection is not allowed. Disable it in options.interaction !'
|
||||||
}
|
}
|
||||||
let node = data.nodes[0]
|
let node = data.nodes[0]
|
||||||
|
|
||||||
let nodeType = splitId(node, 'type')
|
let nodeType = splitId(node, 'type')
|
||||||
switch (nodeType) {
|
switch (nodeType) {
|
||||||
|
|
||||||
case 'person':
|
case 'person':
|
||||||
let person = this.nodes.filter(n => n.id === node)[0]
|
let person = this.nodes.filter(n => n.id === node)[0]
|
||||||
console.log('@@@@@@ event on selected Node', person.id)
|
console.log('@@@@@@ event on selected Node', person.id)
|
||||||
@ -269,6 +268,25 @@ export default {
|
|||||||
throw 'event is undefined for this type of node'
|
throw 'event is undefined for this type of node'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
window.network.on('selectEdge', (data) => {
|
||||||
|
if (data.nodes.length !== 0 && data.edges.length !== 1) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
let linkType = splitId(data.edges[0], 'link') //<------ Uncaught TypeError: id is undefined
|
||||||
|
if (linkType.startsWith('relationship')) {
|
||||||
|
console.log('@@@@@ event on selected Edge', data)
|
||||||
|
console.log('linkType relationship')
|
||||||
|
this.editRelationshipModal(data) //<------ you are here, and data is wrong !
|
||||||
|
}
|
||||||
|
/* Disabled
|
||||||
|
if (linkType.startsWith('household')) {
|
||||||
|
console.log('linkType household')
|
||||||
|
} else
|
||||||
|
if (linkType.startsWith('accompanying_period')) {
|
||||||
|
console.log('linkType accompanying_period')
|
||||||
|
} else
|
||||||
|
*/
|
||||||
|
})
|
||||||
},
|
},
|
||||||
forceUpdateComponent() {
|
forceUpdateComponent() {
|
||||||
//console.log('!! forceUpdateComponent !!')
|
//console.log('!! forceUpdateComponent !!')
|
||||||
|
@ -8,7 +8,7 @@ import { TinyEmitter } from "tiny-emitter";
|
|||||||
* cfr. https://github.com/almende/vis/issues/2524#issuecomment-307108271
|
* cfr. https://github.com/almende/vis/issues/2524#issuecomment-307108271
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//console.log('@@@ init eventHub App @@@')
|
console.log('@@@ init eventHub App @@@')
|
||||||
window.eventHub = new TinyEmitter()
|
window.eventHub = new TinyEmitter()
|
||||||
|
|
||||||
window.network = {}
|
window.network = {}
|
||||||
@ -75,7 +75,7 @@ window.options = {
|
|||||||
},
|
},
|
||||||
interaction: {
|
interaction: {
|
||||||
hover: true,
|
hover: true,
|
||||||
multiselect: false,
|
multiselect: true,
|
||||||
navigationButtons: false,
|
navigationButtons: false,
|
||||||
},
|
},
|
||||||
manipulation: {
|
manipulation: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user