center to origin node in LibraryTree
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
<template>
|
||||
<b-overlay :show="nodeTree.nodes.length === 0" class="h-100" z-index="0">
|
||||
<map-zoom id="library-tree" :min-zoom="0.3" :max-zoom="1">
|
||||
<map-zoom
|
||||
id="library-tree"
|
||||
:min-zoom="0.3" :max-zoom="1" :center="center"
|
||||
:key="nodeDepartId"
|
||||
>
|
||||
<path
|
||||
v-for="link in nodeTree.links"
|
||||
:key="`${link.source.data.id}_${link.target.data.id}`"
|
||||
@@ -77,7 +81,7 @@ export default {
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapGetters(['nodeTree']),
|
||||
...mapGetters(['nodeDepartId', 'nodeTree']),
|
||||
|
||||
dataNodes () {
|
||||
return this.nodeTree.nodes.map(node => node.data)
|
||||
@@ -100,6 +104,11 @@ export default {
|
||||
.force('y', forceY())
|
||||
},
|
||||
|
||||
center () {
|
||||
const { x, y } = this.nodeTree.nodes.length ? this.nodeTree.nodes[0] : { x: 0, y: 0 }
|
||||
return { x, y }
|
||||
},
|
||||
|
||||
// ONE TIME GETTER
|
||||
lineGenerator () {
|
||||
return line().x(node => node.x).y(node => node.y)
|
||||
|
||||
Reference in New Issue
Block a user