Drag object along multiple set paths

I am trying to make a cube follow the path of the lines. As it is right now it can only follow the upper line:
https://jsfiddle.net/habm6spu/43/ .
As far as i’ve read (three.js docs) you can only clamp the cube using 2 values (min,max) which i am using. This is actually used to create a boundary for the cube. So the clamp method creates a Vector3 that limits the object from being moved outside it. How can i make 4 of those Vector3, one for each line?