| Reference | Downloads | Github

Brush tool closes automatically in psychojs/online, despite closeShape : false

URL of experiment: (no credits)

Description of the problem:
If I use the brush tool, or similar manual code, offline in python, it works as intended. If I run it online through javascript however, even when specifying “closeShape : false;” the shape will close when drawn. This ruins the drawing task I have (which is much larger than this- this attached code is just an example). Is there any reason why closeShape : false would not be working as intended? Perhaps overwritten in some way by other js code?

Any help would be much appreciated!

Hi @Aridosecco, on it, thanks for flagging, s.

1 Like


Any luck yet with this?

Hi @Aridosecco, apologies for the late reply. The problem was with PsychoJS ignoring the closeShape option. While a permanent fix is on the way, I have added extra JS code to demonstrate a temporary solution in the support fork. Please let me know if you need more details, s.


Thanks, that worked.
I am not sure how one would integrate this with the actual brush tool in builder mode (you could still go into the generated project.js and change it to use the shapestimcustom), but it works fine if you have custom code very similar to the brush tool. Still it sounds like the full fix is coming so this is not a big issue.

Now there is just the issue of the jittery lines when drawing online!

Hi @Aridosecco, unfortunately the fix cannot be applied inside of a Code component alone, you need to manually edit PsychoPy’s JS output to match the support fork, but again only temporarily, sorry :blush: Not sure what you mean by jittery lines, is that an issue you have raised on a separate thread? x

Hi , the jittery lines issue is discussed here. I have tried it to get around it by also drawing circles when the mouse is moving slowly but that is very complex and does not work very well (yet).

Ah cool, noted, thanks for flagging, x

Hi, posting this in case anyone is still struggling with the jittery lines. It is a partial fix, which draws circles in addition to lines. It is not perfect but it is a considerable improvement.
It also saves the locations of the circles and lines in case you want to re-make the drawings offline from the excel output (though there is nothing to end the experiment in this demo). There is also an undo button. Offline version only draws lines. You will need to download the code then upload to your own pavlovia account to run the online version.

Code: James / DrawDemo · GitLab