Form

visual Form

Form stimulus.

Constructor

new Form(options)

Source:
Mixes In:
Parameters:
Name Type Description
options Object
Properties
Name Type Attributes Default Description
name String

the name used when logging messages from this stimulus

win module:core.Window

the associated Window

pos Array.<number> <optional>
[0, 0]

the position of the center of the slider

size Array.<number>

the size of the slider, e.g. [1, 0.1] for an horizontal slider

units string <optional>
'height'

the units of the Slider position, and font size

color Color <optional>
Color('LightGray')

the color of the slider

contrast number <optional>
1.0

the contrast of the slider

opacity number <optional>
1.0

the opacity of the slider

depth number <optional>
0

the depth (i.e. the z order), note that the text, radio buttons and slider elements are at depth - 1

items Array.<number> <optional>
[]

the array of labels

itemPadding number <optional>
0.05

the granularity

font string <optional>
'Arial'

the text font

fontFamily string <optional>
'Helvetica'

the text font

bold boolean <optional>
true

whether or not the font of the labels is bold

italic boolean <optional>
false

whether or not the font of the labels is italic

fontSize number <optional>

the font size of the labels (in form units), the default fontSize depends on the Form units: 14 for 'pix', 0.03 otherwise

clipMask PIXI.Graphics <optional>
null

the clip mask

autoDraw boolean <optional>
false

whether or not the stimulus should be automatically drawn on every frame flip

autoLog boolean <optional>
false

whether or not to log

Extends

Members

(protected, static, readonly) _defaultItems

Source:

Default form item.

(static, readonly) Layout :Symbol

Source:
Properties:
Name Type Description
HORIZONTAL Symbol
VERTICAL Symbol

Form item layout.

Type:
  • Symbol

(static, readonly) Types :Symbol

Source:
Properties:
Name Type Description
HEADING Symbol
DESCRIPTION Symbol
RATING Symbol
SLIDER Symbol
FREE_TEXT Symbol
CHOICE Symbol
RADIO Symbol

Form item types.

Type:
  • Symbol

Methods

(protected) _estimateBoundingBox()

Source:
Overrides:

Estimate the bounding box.

(protected) _getBoundingBox_px() → {PIXI.Rectangle}

Source:
Overrides:

Get the bounding box in pixel coordinates

Returns:

the bounding box, in pixel coordinates

Type
PIXI.Rectangle

(protected) _importItems()

Source:

Import the form items from either a spreadsheet resource files (.csv, .xlsx, etc.) or from an array.

(protected) _onChange(withPixiopt, withBoundingBoxopt) → {function}

Source:
Overrides:

Generate a callback that prepares updates to the stimulus. This is typically called in the constructor of a stimulus, when attributes are added with _addAttribute.

Parameters:
Name Type Attributes Default Description
withPixi boolean <optional>
false

whether or not the PIXI representation must also be updated

withBoundingBox boolean <optional>
false

whether or not to immediately estimate the bounding box

Returns:
Type
function

(protected) _processItems()

Source:

Import and process the form items from either a spreadsheet resource files (.csv, .xlsx, etc.) or from an array.

(protected) _sanitizeItems()

Source:

Sanitize the form items: check that the keys are valid, and fill in default values.

(protected) _setupStimuli()

Source:

Setup the stimuli, and the scrollbar.

(protected) _updateDecorations()

Source:

Update the form decorations (bounding box, lines between items, etc.)

(protected) _updateIfNeeded()

Source:
Overrides:

Update the form visual representation, if necessary.

This estimate which stimuli are visible, and updates the decorations.

(protected) _updateVisibleStimuli()

Source:

Update the visible stimuli.

addDataToExp(experiment, formatopt)

Source:

Add the form data to the given experiment.

Parameters:
Name Type Attributes Default Description
experiment module:data.ExperimentHandler

the experiment into which to insert the form data

format string <optional>
'rows'

whether to insert the data as rows or as columns

contains(object, units) → {boolean}

Source:
Overrides:

Determine whether an object is inside the bounding box of the stimulus.

Parameters:
Name Type Description
object Object

the object

units string

the units

Returns:

whether or not the object is inside the bounding box of the stimulus

Type
boolean

draw()

Source:
Overrides:

Overridden draw that also calls the draw method of all form elements.

formComplete() → {boolean}

Source:

Check if the form is complete.

Returns:
  • whether there are any remaining incomplete responses.
Type
boolean

getData() → {object}

Source:

Collate the questions and responses into a single dataset.

Returns:
  • the dataset with all questions and responses.
Type
object

hide()

Source:
Overrides:

Overridden hide that also calls the hide method of all form elements.

refresh()

Source:
Overrides:

Force a refresh of the stimulus.

release(logopt)

Source:
Overrides:

Release the PIXI representation, if there is one.

Parameters:
Name Type Attributes Default Description
log boolean <optional>
false

whether to log

reset()

Source:

Reset the form.

setAutoDraw(autoDraw, logopt)

Source:
Overrides:

Setter for the autoDraw attribute.

Parameters:
Name Type Attributes Default Description
autoDraw boolean

the new value

log boolean <optional>
false

whether to log

setDepth(depth, logopt)

Source:
Overrides:

Setter for the depth attribute.

Parameters:
Name Type Attributes Default Description
depth Array.<number> 0

order in which stimuli is rendered, kind of css's z-index with a negative sign.

log boolean <optional>
false

whether of not to log

setOri(ori, logopt)

Source:
Overrides:

Setter for the orientation attribute.

Parameters:
Name Type Attributes Default Description
ori number

the orientation in degree with 0 as the vertical position, positive values rotate clockwise.

log boolean <optional>
false

whether of not to log

setPos(pos, logopt)

Source:
Overrides:

Setter for the position attribute.

Parameters:
Name Type Attributes Default Description
pos Array.<number>

position of the center of the stimulus, in stimulus units

log boolean <optional>
false

whether of not to log

setSize(size, logopt)

Source:
Overrides:

Setter for the size attribute.

Parameters:
Name Type Attributes Default Description
size undefined | null | number | Array.<number>

the stimulus size

log boolean <optional>
false

whether of not to log