Raycast function for three.js Line2
that accounts for line width
npm install three-line-raycast
import { Line2 } from "three/examples/jsm/lines/Line2.js";
import { LineRaycast } from 'three-line-raycast'
First create a Line2 Mesh, then add the LineRaycast function.
Details on Line2 can be found at the three.js example
line = new Line2( geometry, matLine );
line.raycast = LineRaycast;