Skip to content

Commit 21c204b

Browse files
committed
Use cursor: grab for diagram if props.zoomable
1 parent a8d149d commit 21c204b

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

src/Tree/index.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,18 @@ export default class Tree extends React.Component {
219219
}
220220

221221
render() {
222-
const { orientation, translate, pathFunc, depthFactor, transitionDuration } = this.props;
223222
const { nodes, links } = this.generateTree();
223+
const {
224+
orientation,
225+
translate,
226+
pathFunc,
227+
depthFactor,
228+
transitionDuration,
229+
zoomable,
230+
} = this.props;
224231

225232
return (
226-
<div className="rd3t-tree-container">
233+
<div className={`rd3t-tree-container ${zoomable ? 'grabbable' : undefined}`}>
227234
<svg className="rd3t-svg" width="100%" height="100%">
228235
<TransitionGroup
229236
component="g"

src/Tree/style.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,15 @@
22
width: 100%;
33
height: 100%;
44
}
5+
6+
.grabbable {
7+
cursor: move; /* fallback if grab cursor is unsupported */
8+
cursor: grab;
9+
cursor: -moz-grab;
10+
cursor: -webkit-grab;
11+
}
12+
.grabbable:active {
13+
cursor: grabbing;
14+
cursor: -moz-grabbing;
15+
cursor: -webkit-grabbing;
16+
}

0 commit comments

Comments
 (0)