|
Last change
on this file since e4c61dd was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago |
|
Prototype 1.1
|
-
Property mode
set to
100644
|
|
File size:
460 bytes
|
| Line | |
|---|
| 1 | import {min} from "d3-array";
|
|---|
| 2 |
|
|---|
| 3 | function targetDepth(d) {
|
|---|
| 4 | return d.target.depth;
|
|---|
| 5 | }
|
|---|
| 6 |
|
|---|
| 7 | export function left(node) {
|
|---|
| 8 | return node.depth;
|
|---|
| 9 | }
|
|---|
| 10 |
|
|---|
| 11 | export function right(node, n) {
|
|---|
| 12 | return n - 1 - node.height;
|
|---|
| 13 | }
|
|---|
| 14 |
|
|---|
| 15 | export function justify(node, n) {
|
|---|
| 16 | return node.sourceLinks.length ? node.depth : n - 1;
|
|---|
| 17 | }
|
|---|
| 18 |
|
|---|
| 19 | export function center(node) {
|
|---|
| 20 | return node.targetLinks.length ? node.depth
|
|---|
| 21 | : node.sourceLinks.length ? min(node.sourceLinks, targetDepth) - 1
|
|---|
| 22 | : 0;
|
|---|
| 23 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.