Skip to content

Commit

Permalink
Simplify exandpall
Browse files Browse the repository at this point in the history
  • Loading branch information
David-Desmaisons committed Sep 26, 2019
1 parent 8083912 commit 2a3e300
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 20 deletions.
12 changes: 2 additions & 10 deletions src/Tree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { drawLink as orthogonal } from './linkLayout/orthogonal'
import collapseOnClick from './behaviors/CollapseOnClick'
import selectOnTextClick from './behaviors/SelectOnTextClick'
import contextMenuOnClickText from './behaviors/ContextMenuOnClickText'
import {compareString, toPromise, findInParents, mapMany, translate} from './d3-utils'
import {compareString, toPromise, mapMany, translate} from './d3-utils'
import {renderInVueContext} from './vueHelper'
import {setUpZoom} from './zoom/zoomBehavior'
import {createPopper} from './contextMenu'
Expand Down Expand Up @@ -522,13 +522,6 @@ export default {
this.$nextTick(() => this.updateGraph(null, option))
},
getNodeOriginComputer (originalVisibleNodes) {
return node => {
const parentVisible = findInParents(node, originalVisibleNodes)
return {x: parentVisible.x0, y: parentVisible.y0}
}
},
applyZoom (size, transition) {
const { internaldata: {g, zoom}, zoomable } = this
if (zoomable && zoom) {
Expand Down Expand Up @@ -567,9 +560,8 @@ export default {
},
expandAll (d, update = true) {
const lastVisible = d.leaves()
onAllChilddren(d, child => { this.expand(child, false) })
return this.updateIfNeeded(this.getNodeOriginComputer(lastVisible), update)
return this.updateIfNeeded(null, update)
},
collapseAll (d, update = true) {
Expand Down
10 changes: 0 additions & 10 deletions src/d3-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,6 @@ function compareNode (a, b, attribute) {
return compareString(a.data[attribute], b.data[attribute])
}

function findInParents (node, nodes) {
if (nodes.indexOf(node) !== -1) {
return node
}

const parent = node.parent
return (parent === null) ? node : findInParents(parent, nodes)
}

function mapMany (arr, mapper) {
return arr.reduce(function (prev, curr) {
return prev.concat(mapper(curr))
Expand Down Expand Up @@ -98,7 +89,6 @@ function updateTexts (selection, maxLength) {
export {
compareString,
compareNode,
findInParents,
mapMany,
roundPath,
toPromise,
Expand Down

0 comments on commit 2a3e300

Please sign in to comment.