Skip to content

Commit fa852b9

Browse files
committed
Add screen2GraphCoords to 3D
1 parent 3585fe5 commit fa852b9

File tree

5 files changed

+5
-3
lines changed

5 files changed

+5
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ Note that not all props listed below apply to all 4 components. The last 4 colum
242242
| Method | Arguments | Description | 2D | 3D | VR | AR |
243243
| --- | :--: | --- | :--: | :--: | :--: | :--: |
244244
| <b>getGraphBbox</b> | ([<i>nodeFilterFn</i>]) | Returns the current bounding box of the nodes in the graph, formatted as `{ x: [<num>, <num>], y: [<num>, <num>], z: [<num>, <num>] }`. If no nodes are found, returns `null`. Accepts an optional argument to define a custom node filter: `node => <boolean>`, which should return a truthy value if the node is to be included. This can be useful to calculate the bounding box of a portion of the graph. | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
245-
| <b>screen2GraphCoords</b> | (<i>x</i>, <i>y</i>) | Utility method to translate viewport coordinates to the graph domain. Given a pair of `x`,`y` screen coordinates, returns the current equivalent `{x, y}` in the domain of graph node coordinates. | :heavy_check_mark: | | | |
245+
| <b>screen2GraphCoords</b> | (<i>x</i>, <i>y</i>[, <i>distance</i>]) | Utility method to translate viewport coordinates to the graph domain. Given a pair of `x`,`y` screen coordinates, and optionally distance from camera for 3D mode, returns the current equivalent `{x, y (, z)}` in the domain of graph node coordinates. | :heavy_check_mark: | :heavy_check_mark: | | |
246246
| <b>graph2ScreenCoords</b> | (<i>x</i>, <i>y</i>[, <i>z</i>]) | Utility method to translate node coordinates to the viewport domain. Given a set of `x`,`y`(,`z`) graph coordinates, returns the current equivalent `{x, y}` in viewport coordinates. | :heavy_check_mark: | :heavy_check_mark: | | |
247247

248248
### Input JSON syntax

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"dist/**/*"
4141
],
4242
"dependencies": {
43-
"3d-force-graph": "^1.68.1",
43+
"3d-force-graph": "^1.69.1",
4444
"3d-force-graph-ar": "^1.6.3",
4545
"3d-force-graph-vr": "^1.35.3",
4646
"force-graph": "^1.39.2",

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ export interface ForceGraphMethods {
149149

150150
// Utility
151151
getGraphBbox(nodeFilter?: (node: NodeObject) => boolean): { x: [number, number], y: [number, number], z: [number, number] };
152+
screen2GraphCoords(x: number, y: number, distance: number): Coords;
152153
graph2ScreenCoords(x: number, y: number, z: number): Coords;
153154
}
154155

src/packages/react-force-graph-3d/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const ForceGraph3D = fromKapsule(
1515
'cameraPosition',
1616
'zoomToFit',
1717
'getGraphBbox',
18+
'screen2GraphCoordinates',
1819
'graph2ScreenCoords',
1920
'postProcessingComposer',
2021
'scene',

src/packages/react-force-graph-3d/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-
"3d-force-graph": "^1.68.1",
39+
"3d-force-graph": "^1.69.1",
4040
"prop-types": "^15.7.2",
4141
"react-kapsule": "^2.2.1"
4242
},

0 commit comments

Comments
 (0)