update LibraryTree with MapZoom
This commit is contained in:
@@ -177,7 +177,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
activeNodes: (state) => {
|
||||
activeNodes: state => {
|
||||
if (!state.nodebook) return []
|
||||
return state.nodebook.reduce((acc, ids) => [...acc, ...ids], [])
|
||||
},
|
||||
@@ -218,8 +218,7 @@ export default {
|
||||
},
|
||||
|
||||
nodeTree: (state, rootState) => {
|
||||
if (state.nodeDepartId === undefined) return
|
||||
return state.trees[state.nodeDepartId]
|
||||
return state.trees[state.nodeDepartId] || { nodes: [], links: [] }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,6 +92,8 @@ export function buildTree (treeData, nodesData) {
|
||||
if (!uniqueIds.includes(node.id)) {
|
||||
uniqueIds.push(node.id)
|
||||
node.data = nodesData.find(n => n.id === node.id)
|
||||
// Add `x` and `y` keys so Vue can update on these values updates
|
||||
Object.assign(node, { x: undefined, y: undefined })
|
||||
nodes.push(node)
|
||||
if (node.children) {
|
||||
node.children.forEach(child => {
|
||||
|
||||
Reference in New Issue
Block a user