psychopy.org | Reference | Downloads | Github

Rect lineWidth values don't copy to JavaScript

URL of experiment: https://pavlovia.org/run/djangraw/losagamblingtask_v2-0/html/

Description of the problem: When I create a rectangle stimulus and specify a line width of 5 in the builder, the Python version displays a thick line, but the JS version displays a thin one. The problem appears to be that the lineWidth value reverts to 1 when producing the javascript code. Here’s a sample of the relevant Python and JS code the builder produces (note the different lineWidth values):

Python:

rectOutcome = visual.Rect(
    win=win, name='rectOutcome',units='norm', 
    width=(1.0, 1.0)[0], height=(1.0, 1.0)[1],
    ori=0, pos=[0,0],
    lineWidth=5, lineColor=[-1,1,-1], lineColorSpace='rgb',
    fillColor=[0,0,0], fillColorSpace='rgb',
    opacity=1, depth=-1.0, interpolate=True)

Javascript:

  rectOutcome = new visual.Rect ({
    win: psychoJS.window, name: 'rectOutcome',
    units: psychoJS.window.units,
    width: outRectWH[0], height: outRectWH[1],
    ori: 0, pos: outRectXY,
    lineWidth: 1, lineColor: new util.Color([(- 1), 1, (- 1)]),
    fillColor: new util.Color([0, 0, 0]),
    opacity: 1, depth: -1.0, interpolate: true,
  });

@djangraw, this was added in a recent commit (see below). The fix should be out in the next release.