Object contains brush

Version 2022.2.5

Description of the problem: I have a brush that is drawing in the opposite direction to the cursor in an online experiment. My issue is that I need to check if the brush’s drawn line overlaps with other objects (e.g. collides with a specific object, ends routine)

Does anyone has any suggestions in how to approach this? I tried with the syntax myobject.contains(mybrushPointer) but apparently it’s usable in the p5 javascript library which is not compatible with PsychoPy Js

Any suggestions would much appreciated.