Skip to content

Commit 6585644

Browse files
committed
Fix vasturiano#271. Add linkPointerAreaPaint prop
1 parent 2a17008 commit 6585644

File tree

5 files changed

+7
-4
lines changed

5 files changed

+7
-4
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,8 @@ Note that not all props listed below apply to all 4 components. The last 4 colum
235235
| <b>enableNavigationControls</b> | <i>bool</i> | `true` | Whether to enable the trackball navigation controls used to move the camera using mouse interactions (rotate/zoom/pan). | | :heavy_check_mark: | | |
236236
| <b>enablePointerInteraction</b> | <i>bool</i> | `true` | Whether to enable the mouse tracking events. This activates an internal tracker of the canvas mouse position and enables the functionality of object hover/click and tooltip labels, at the cost of performance. If you're looking for maximum gain in your graph performance it's recommended to switch off this property. | :heavy_check_mark: | :heavy_check_mark: | | |
237237
| <b>enableNodeDrag</b> | <i>bool</i> | `true` | Whether to enable the user interaction to drag nodes by click-dragging. If enabled, every time a node is dragged the simulation is re-heated so the other nodes react to the changes. Only applicable if enablePointerInteraction is `true`. | :heavy_check_mark: | :heavy_check_mark: | | |
238-
| <b>nodePointerAreaPaint</b> | <i>func</i> | *default interaction area is a circle centered on the node and sized according to `val`.* | Callback function for painting a canvas area used to detect node pointer interactions. The provided paint color uniquely identifies the node and should be used to perform drawing operations on the provided canvas context. This painted area will not be visible, but instead be used to detect pointer interactions with the node. The callback function has the signature: `.nodePointerAreaPaint(<node>, <color>, <canvas context>, <current global scale>)`. | :heavy_check_mark: | | | |
238+
| <b>nodePointerAreaPaint</b> | <i>func</i> | *default interaction area is a circle centered on the node and sized according to `val`.* | Callback function for painting a canvas area used to detect node pointer interactions. The provided paint color uniquely identifies the node and should be used to perform drawing operations on the provided canvas context. This painted area will not be visible, but instead be used to detect pointer interactions with the node. The callback function has the signature: `nodePointerAreaPaint(<node>, <color>, <canvas context>, <current global scale>)`. | :heavy_check_mark: | | | |
239+
| <b>linkPointerAreaPaint</b> | <i>func</i> | *default interaction area is a straight line between the source and target nodes.* | Callback function for painting a canvas area used to detect link pointer interactions. The provided paint color uniquely identifies the link and should be used to perform drawing operations on the provided canvas context. This painted area will not be visible, but instead be used to detect pointer interactions with the link. The callback function has the signature: `linkPointerAreaPaint(<link>, <color>, <canvas context>, <current global scale>)`. | :heavy_check_mark: | | | |
239240

240241
### Utility
241242

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"3d-force-graph": "^1.69.2",
4444
"3d-force-graph-ar": "^1.6.4",
4545
"3d-force-graph-vr": "^1.35.4",
46-
"force-graph": "^1.39.2",
46+
"force-graph": "^1.40.0",
4747
"prop-types": "^15.7.2",
4848
"react-kapsule": "^2.2.1"
4949
},

src/forcegraph-proptypes.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,9 @@ export const ForceGraph2DPropTypes = Object.assign({},
9090
nodeCanvasObjectMode: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
9191
nodeCanvasObject: PropTypes.func,
9292
nodePointerAreaPaint: PropTypes.func,
93-
linkCanvasObject: PropTypes.func,
9493
linkCanvasObjectMode: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
94+
linkCanvasObject: PropTypes.func,
95+
linkPointerAreaPaint: PropTypes.func,
9596
autoPauseRedraw: PropTypes.bool,
9697
minZoom: PropTypes.number,
9798
maxZoom: PropTypes.number,

src/packages/react-force-graph-2d/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export interface ForceGraphProps {
7676
linkDirectionalParticleSpeed?: LinkAccessor<number>;
7777
linkDirectionalParticleWidth?: LinkAccessor<number>;
7878
linkDirectionalParticleColor?: LinkAccessor<string>;
79+
linkPointerAreaPaint?: CanvasPointerAreaPaintFn<LinkObject>;
7980

8081
// Render control
8182
autoPauseRedraw?: boolean;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"dist/**/*"
3636
],
3737
"dependencies": {
38-
"force-graph": "^1.39.2",
38+
"force-graph": "^1.40.0",
3939
"prop-types": "^15.7.2",
4040
"react-kapsule": "^2.2.1"
4141
},

0 commit comments

Comments
 (0)