mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 16:31:52 +01:00
config redirect
This commit is contained in:
24
node_modules/non-layered-tidy-tree-layout/test/tree-node.js
generated
vendored
Normal file
24
node_modules/non-layered-tidy-tree-layout/test/tree-node.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
export default class TreeNode {
|
||||
constructor(width, height) {
|
||||
this.width = width
|
||||
this.height = height
|
||||
this.x = 0
|
||||
this.y = 0
|
||||
this.children = []
|
||||
}
|
||||
|
||||
addChild(child) {
|
||||
child.y = this.y + this.height
|
||||
this.children.push(child)
|
||||
}
|
||||
|
||||
randExpand(tree) {
|
||||
tree.y += this.height
|
||||
const i = Math.floor(Math.random() * (this.children.length + 1))
|
||||
if (i === this.children.length) {
|
||||
this.children.push(tree)
|
||||
} else {
|
||||
this.children[i].randExpand(tree)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user