psychopy.org | Reference | Downloads | Github

TypeError: mouse.isPressedIn is not a function

Hi, I am trying to make a routine using drag and drop. I added some custom code, but it seems like Pavlovia doesn’t support mouse.isPressedln function. I read up on some posts and tried to use object.contains(mouse) instead, but the same error stay occurs. Heres some pictures of the custom code. Any advice would be helpful.

@Jane, there is a drag and drop demo on Pavlovia (see links below). This issue is because isPressedIn is not supported online for now. The equivalent code is:

if ( object.contains(mouse) && mouse.getPressed()[0] === 1 )
{
  // Execute this code
}

https://run.pavlovia.org/demos/draganddrop/html/

@dvbridges Thank you so much for replying. I tried to follow the same format as the demo. I replaced the code and everything. But the same error still shows up. Here is the updated code.

The python and JS code seem to be doing different things. Also, we can’t see all of it. If you copy the code itself to the forum and put ``` above and below it (not ', but the accent mark) we’ll be able to see the full code formatted.

Notably, the first condition seems to be missing a replacement for isPressedIn, it’s just checking if “grabbed” exists and then if the mouse has been pressed, not if the grabbed object contains the mouse.