File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ extension ForceDirectedGraphModel {
7
7
internal func findNode(
8
8
at locationInSimulationCoordinate: SIMD2 < Double >
9
9
) -> NodeID ? {
10
+
11
+ let viewportScale = self . finalTransform. scale
12
+
10
13
for i in simulationContext. storage. kinetics. range. reversed ( ) {
11
14
let iNodeID = simulationContext. nodeIndices [ i]
12
15
guard
@@ -16,9 +19,10 @@ extension ForceDirectedGraphModel {
16
19
else { continue }
17
20
let iPos = simulationContext. storage. kinetics. position [ i]
18
21
19
-
20
- if simd_length_squared ( locationInSimulationCoordinate - iPos) <= iRadius2
21
- {
22
+ let scaledRadius2 = iRadius2 / max( . ulpOfOne, ( 8.0 * viewportScale * viewportScale) )
23
+ let length2 = simd_length_squared ( locationInSimulationCoordinate - iPos)
24
+
25
+ if length2 <= scaledRadius2 {
22
26
return iNodeID
23
27
}
24
28
}
You can’t perform that action at this time.
0 commit comments