Constructor
new Form(options)
- Source:
- Mixes In:
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
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 |