mouse.isPressedIn Problems

URL of experiment:

Description of the problem:
In my experiment I have the participants click on a graph image, and I record the mouse click location in x and y coordinates into a data file.
I have it set currently so that when participants click the image it displays an ‘x’ in the location of their click, and they can click again to change the position of the ‘x’. I only want to record the position of the final click location.
To do this I use the mouse.isPressedIn function which does not work online. After looking at the “code component to mouse clicks” thread on discourse already, I have determined I will need to custom code this in java, but none of the experiments that this has been solved for looked similar to mine.
I know I will need the following in ‘Begin Routine’:

mouse.x = [];
mouse.y = [];

And something like this in “Each frame”:

const xys = mouse.getPos(); // get mouse coordinates
mouse.x.push(xys[0]); // add mouse coordinates to x/y list, in principle for data storage, but not implemented right now

in the java component. However, this does not do what I want yet, any guidance on how to further adapt my code to make it function online would be great!

I am including the current custom python code I have for my mouse click below:
Begin routine:

allText = []
clickN = 'x'
getLoc = None
addText = False

def makeText(clickN):
    return visual.TextStim(

Each Frame:

if mouse.isPressedIn(image) and getLoc is None:
    getLoc = mouse.getPos()

if not mouse.isPressedIn(image) and getLoc is not None:
    if(len(allText) > 0):
    getLoc = None

End Routine:

for letter in allText:

Thanks so much!

hi, did you manage to solve the problem?