Skip to content

Commit d5710c4

Browse files
committed
Add support for right-click events
1 parent 4b7d765 commit d5710c4

File tree

5 files changed

+10
-6
lines changed

5 files changed

+10
-6
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,13 @@ Note that not all props listed below apply to all 3 components. The last 3 colum
157157
### Interaction
158158
| Prop | Type | Default | Description | 2D | 3D | VR |
159159
| --- | :--: | :--: | --- | :--: | :--: | :--: |
160-
| <b>onNodeClick</b> | <i>func</i> | *-* | Callback function for node clicks. The node object is included as single argument `onNodeClick(node)`. | :heavy_check_mark: | :heavy_check_mark: | |
160+
| <b>onNodeClick</b> | <i>func</i> | *-* | Callback function for node (left-button) clicks. The node object is included as single argument `onNodeClick(node)`. | :heavy_check_mark: | :heavy_check_mark: | |
161+
| <b>onNodeRightClick</b> | <i>func</i> | *-* | Callback function for node right-clicks. The node object is included as single argument `onNodeRightClick(node)`. | :heavy_check_mark: | :heavy_check_mark: | |
161162
| <b>onNodeHover</b> | <i>func</i> | *-* | Callback function for node mouse over events. The node object (or `null` if there's no node under the mouse line of sight) is included as the first argument, and the previous node object (or null) as second argument: `onNodeHover(node, prevNode)`. | :heavy_check_mark: | :heavy_check_mark: | |
162163
| <b>onNodeDrag</b> | <i>func</i> | *-* | Callback function for node drag interactions. This function is invoked repeatedly while dragging a node, every time its position is updated. The node object is included as single argument `onNodeDrag(node)`. | :heavy_check_mark: | :heavy_check_mark: | |
163164
| <b>onNodeDragEnd</b> | <i>func</i> | *-* | Callback function for the end of node drag interactions. This function is invoked when the node is released. The node object is included as single argument `onNodeDragEnd(node)`. | :heavy_check_mark: | :heavy_check_mark: | |
164-
| <b>onLinkClick</b> | <i>func</i> | *-* | Callback function for link clicks. The link object is included as single argument `onLinkClick(link)`. | :heavy_check_mark: | :heavy_check_mark: | |
165+
| <b>onLinkClick</b> | <i>func</i> | *-* | Callback function for link (left-button) clicks. The link object is included as single argument `onLinkClick(link)`. | :heavy_check_mark: | :heavy_check_mark: | |
166+
| <b>onLinkRightClick</b> | <i>func</i> | *-* | Callback function for link right-clicks. The link object is included as single argument `onLinkRightClick(link)`. | :heavy_check_mark: | :heavy_check_mark: | |
165167
| <b>onLinkHover</b> | <i>func</i> | *-* | Callback function for link mouse over events. The link object (or `null` if there's no link under the mouse line of sight) is included as the first argument, and the previous link object (or null) as second argument: `onLinkHover(link, prevLink)`. | :heavy_check_mark: | :heavy_check_mark: | |
166168
| <b>linkHoverPrecision</b> | <i>number</i> | 4 | Whether to display the link label when gazing the link closely (low value) or from far away (high value). | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
167169
| <b>controlType</b> | <i>str</i> | `trackball` | Which type of control to use to control the camera on 3D mode. Choice between [trackball](https://threejs.org/examples/misc_controls_trackball.html), [orbit](https://threejs.org/examples/#misc_controls_orbit) or [fly](https://threejs.org/examples/misc_controls_fly.html). | | :heavy_check_mark: | |

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@
4141
"example/**/*"
4242
],
4343
"dependencies": {
44-
"3d-force-graph": "^1.44.0",
44+
"3d-force-graph": "^1.45.0",
4545
"3d-force-graph-vr": "^1.23.0",
46-
"force-graph": "^1.13.1",
46+
"force-graph": "^1.14.0",
4747
"prop-types": "^15.6.2",
4848
"react-kapsule": "^1.4.1"
4949
},

src/forcegraph-proptypes.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,12 @@ const commonPropTypes = {
4343

4444
const pointerBasedPropTypes = {
4545
onNodeClick: PropTypes.func,
46+
onNodeRightClick: PropTypes.func,
4647
onNodeHover: PropTypes.func,
4748
onNodeDrag: PropTypes.func,
4849
onNodeDragEnd: PropTypes.func,
4950
onLinkClick: PropTypes.func,
51+
onLinkRightClick: PropTypes.func,
5052
onLinkHover: PropTypes.func,
5153
enablePointerInteraction: PropTypes.bool,
5254
enableNodeDrag: PropTypes.bool

src/packages/react-force-graph-2d/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"dist/**/*"
3737
],
3838
"dependencies": {
39-
"force-graph": "^1.13.1",
39+
"force-graph": "^1.14.0",
4040
"prop-types": "^15.6.2",
4141
"react-kapsule": "^1.4.1"
4242
},

src/packages/react-force-graph-3d/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"dist/**/*"
3838
],
3939
"dependencies": {
40-
"3d-force-graph": "^1.44.0",
40+
"3d-force-graph": "^1.45.0",
4141
"prop-types": "^15.6.2",
4242
"react-kapsule": "^1.4.1"
4343
},

0 commit comments

Comments
 (0)