Skip to content

Commit dd23a6e

Browse files
committed
Merge branch 'feature/18-expose-circle-radius' into develop
2 parents 86e4db2 + 6c80f00 commit dd23a6e

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ class MyComponent extends React.Component {
9090
| `scaleExtent` | `object` | `{min: 0..n, max: 0..n}` | | `{min: 0.1, max: 1}` | Sets the minimum/maximum extent to which the tree can be scaled if `props.zoomable` is true. |
9191
| `nodeSize` | `object` | `{x: 0..n, y: 0..n}` | | `{x: 140, y: 140}` | Sets a fixed size for each node. <br /><br /> This does not affect node circle sizes, circle sizes are handled by the `circleRadius` prop. |
9292
| `separation` | `object` | `{siblings: 0..n, nonSiblings: 0..n}` | | `{siblings: 1, nonSiblings: 2}` | Sets separation between neighbouring nodes, differentiating between siblings (same parent) and non-siblings. |
93+
| `circleRadius` | `number` | `0..n` | | `10` | Sets the radius of each node's `<circle>` element. |
9394
| `transitionDuration` | `number` | `0..n` | | `500` | Sets the animation duration (in ms) of each expansion/collapse of a tree node. <br /><br /> Set this to `0` to deactivate animations completely. |
9495
| `styles` | `object` | see [Styling](#styling) | | `Node`/`Link` CSS files | Overrides and/or enhances the tree's default styling. |
9596

src/Node/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ export default class Node extends React.Component {
114114
}
115115

116116
Node.defaultProps = {
117-
circleRadius: 10,
118117
textAnchor: 'start',
119118
attributes: undefined,
120119
};
@@ -130,6 +129,6 @@ Node.propTypes = {
130129
name: PropTypes.string.isRequired,
131130
attributes: PropTypes.object,
132131
textAnchor: PropTypes.string,
133-
circleRadius: PropTypes.number,
132+
circleRadius: PropTypes.number.isRequired,
134133
styles: PropTypes.object.isRequired,
135134
};

src/Node/tests/index.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ describe('<Node />', () => {
2222
orientation: 'horizontal',
2323
transitionDuration: 500,
2424
onClick: () => {},
25+
circleRadius: 10,
2526
styles: {},
2627
};
2728

src/Tree/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ export default class Tree extends React.Component {
246246
pathFunc,
247247
transitionDuration,
248248
zoomable,
249+
circleRadius,
249250
styles,
250251
} = this.props;
251252

@@ -267,6 +268,7 @@ export default class Tree extends React.Component {
267268
name={nodeData.name}
268269
attributes={nodeData.attributes}
269270
onClick={this.handleNodeToggle}
271+
circleRadius={circleRadius}
270272
styles={styles.nodes}
271273
/>
272274
)}
@@ -300,6 +302,7 @@ Tree.defaultProps = {
300302
scaleExtent: { min: 0.1, max: 1 },
301303
nodeSize: { x: 140, y: 140 },
302304
separation: { siblings: 1, nonSiblings: 2 },
305+
circleRadius: 10,
303306
styles: {
304307
nodes: {
305308
node: {
@@ -348,6 +351,7 @@ Tree.propTypes = {
348351
siblings: PropTypes.number,
349352
nonSiblings: PropTypes.number,
350353
}),
354+
circleRadius: PropTypes.number,
351355
styles: PropTypes.shape({
352356
nodes: PropTypes.object,
353357
links: PropTypes.object,

0 commit comments

Comments
 (0)