1
0
mirror of https://github.com/psychopy/psychojs.git synced 2025-05-10 10:40:54 +00:00
psychojs/docs/module-visual.Form.html
Alain Pitiot 73cb6f6e40 _
2021-04-27 08:20:15 +02:00

2207 lines
31 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: Form</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Class: Form</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>
<span class="ancestors"><a href="module-visual.html">visual</a>.</span>Form<span class="signature">(options)</span><span class="type-signature"></span></h2>
</header>
<article>
<div class="container-overview">
<h4 class="name" id="Form"><span class="type-signature"></span>new Form<span class="signature">(options)</span><span class="type-signature"></span></h4>
<div class="description">
Form stimulus.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">the name used when logging messages from this stimulus</td>
</tr>
<tr>
<td class="name"><code>win</code></td>
<td class="type">
<span class="param-type"><a href="module-core.Window.html">module:core.Window</a></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">the associated Window</td>
</tr>
<tr>
<td class="name"><code>pos</code></td>
<td class="type">
<span class="param-type">Array.&lt;number></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
[0, 0]
</td>
<td class="description last">the position of the center of the slider</td>
</tr>
<tr>
<td class="name"><code>size</code></td>
<td class="type">
<span class="param-type">Array.&lt;number></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">the size of the slider, e.g. [1, 0.1] for an horizontal slider</td>
</tr>
<tr>
<td class="name"><code>units</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
'height'
</td>
<td class="description last">the units of the Slider position, and font size</td>
</tr>
<tr>
<td class="name"><code>color</code></td>
<td class="type">
<span class="param-type">Color</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
Color('LightGray')
</td>
<td class="description last">the color of the slider</td>
</tr>
<tr>
<td class="name"><code>contrast</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
1.0
</td>
<td class="description last">the contrast of the slider</td>
</tr>
<tr>
<td class="name"><code>opacity</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
1.0
</td>
<td class="description last">the opacity of the slider</td>
</tr>
<tr>
<td class="name"><code>depth</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
0
</td>
<td class="description last">the depth (i.e. the z order), note that the text, radio buttons and slider elements are at depth + 1</td>
</tr>
<tr>
<td class="name"><code>items</code></td>
<td class="type">
<span class="param-type">Array.&lt;number></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
[]
</td>
<td class="description last">the array of labels</td>
</tr>
<tr>
<td class="name"><code>itemPadding</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
0.05
</td>
<td class="description last">the granularity</td>
</tr>
<tr>
<td class="name"><code>fontFamily</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
'Helvetica'
</td>
<td class="description last">the text font</td>
</tr>
<tr>
<td class="name"><code>bold</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
true
</td>
<td class="description last">whether or not the font of the labels is bold</td>
</tr>
<tr>
<td class="name"><code>italic</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last">whether or not the font of the labels is italic</td>
</tr>
<tr>
<td class="name"><code>fontSize</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last">the font size of the labels (in form units), the default fontSize
depends on the Form units: 14 for 'pix', 0.03 otherwise</td>
</tr>
<tr>
<td class="name"><code>clipMask</code></td>
<td class="type">
<span class="param-type">PIXI.Graphics</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
null
</td>
<td class="description last">the clip mask</td>
</tr>
<tr>
<td class="name"><code>autoDraw</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last">whether or not the stimulus should be automatically drawn on every
frame flip</td>
</tr>
<tr>
<td class="name"><code>autoLog</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last">whether or not to log</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="mixes">Mixes In:</dt>
<dd class="mixes"><ul>
<li><a href="module-util.ColorMixin.html">module:util.ColorMixin</a></li>
</ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="visual_Form.js.html">visual/Form.js</a>, <a href="visual_Form.js.html#line22">line 22</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Extends</h3>
<ul>
<li><a href="module-visual.VisualStim.html">module:visual.VisualStim</a></li>
</ul>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id="contains"><span class="type-signature"></span>contains<span class="type-signature"></span></h4>
<div class="description">
Determine whether an object is inside the bounding box of the stimulus.
</div>
<dl class="details">
<dt class="tag-overrides">Overrides:</dt>
<dd class="tag-overrides"><ul class="dummy"><li>
<a href="module-visual.VisualStim.html#contains">module:visual.VisualStim#contains</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="visual_VisualStim.js.html">visual/VisualStim.js</a>, <a href="visual_VisualStim.js.html#line190">line 190</a>
</li></ul></dd>
</dl>
<h4 class="name" id="setOri"><span class="type-signature"></span>setOri<span class="type-signature"></span></h4>
<div class="description">
Setter for the orientation attribute.
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="module-visual.VisualStim.html#setOri">module:visual.VisualStim#setOri</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="visual_VisualStim.js.html">visual/VisualStim.js</a>, <a href="visual_VisualStim.js.html#line141">line 141</a>
</li></ul></dd>
</dl>
<h4 class="name" id="setPos"><span class="type-signature"></span>setPos<span class="type-signature"></span></h4>
<div class="description">
Setter for the position attribute.
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="module-visual.VisualStim.html#setPos">module:visual.VisualStim#setPos</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="visual_VisualStim.js.html">visual/VisualStim.js</a>, <a href="visual_VisualStim.js.html#line165">line 165</a>
</li></ul></dd>
</dl>
<h4 class="name" id="setSize"><span class="type-signature"></span>setSize<span class="type-signature"></span></h4>
<div class="description">
Setter for the size attribute.
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="module-visual.VisualStim.html#setSize">module:visual.VisualStim#setSize</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="visual_VisualStim.js.html">visual/VisualStim.js</a>, <a href="visual_VisualStim.js.html#line111">line 111</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="_estimateBoundingBox"><span class="type-signature">(protected) </span>_estimateBoundingBox<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Estimate the bounding box.
</div>
<dl class="details">
<dt class="tag-overrides">Overrides:</dt>
<dd class="tag-overrides"><ul class="dummy"><li>
<a href="module-visual.VisualStim.html#_estimateBoundingBox">module:visual.VisualStim#_estimateBoundingBox</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="visual_Form.js.html">visual/Form.js</a>, <a href="visual_Form.js.html#line615">line 615</a>
</li></ul></dd>
</dl>
<h4 class="name" id="_onChange"><span class="type-signature">(protected) </span>_onChange<span class="signature">(withPixi<span class="signature-attributes">opt</span>, withBoundingBox<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {function}</span></h4>
<div class="description">
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.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>withPixi</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last">whether or not the PIXI representation must also be updated</td>
</tr>
<tr>
<td class="name"><code>withBoundingBox</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last">whether or not to immediately estimate the bounding box</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="module-visual.VisualStim.html#_onChange">module:visual.VisualStim#_onChange</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="visual_VisualStim.js.html">visual/VisualStim.js</a>, <a href="visual_VisualStim.js.html#line278">line 278</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">function</span>
</dd>
</dl>
<h4 class="name" id="addDataToExp"><span class="type-signature"></span>addDataToExp<span class="signature">(experiment, format<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<div class="description">
Add the form data to the given experiment.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>experiment</code></td>
<td class="type">
<span class="param-type"><a href="module-data.ExperimentHandler.html">module:data.ExperimentHandler</a></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">the experiment into which to insert the form data</td>
</tr>
<tr>
<td class="name"><code>format</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
'rows'
</td>
<td class="description last">whether to insert the data as rows or as columns</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="visual_Form.js.html">visual/Form.js</a>, <a href="visual_Form.js.html#line335">line 335</a>
</li></ul></dd>
</dl>
<h4 class="name" id="draw"><span class="type-signature"></span>draw<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Overridden draw that also calls the draw method of all form elements.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="visual_Form.js.html">visual/Form.js</a>, <a href="visual_Form.js.html#line176">line 176</a>
</li></ul></dd>
</dl>
<h4 class="name" id="getData"><span class="type-signature"></span>getData<span class="signature">()</span><span class="type-signature"> &rarr; {object}</span></h4>
<div class="description">
Collate the questions and responses into a single dataset.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="visual_Form.js.html">visual/Form.js</a>, <a href="visual_Form.js.html#line285">line 285</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- the dataset with all questions and responses.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">object</span>
</dd>
</dl>
<h4 class="name" id="hide"><span class="type-signature"></span>hide<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Overridden hide that also calls the hide method of all form elements.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="visual_Form.js.html">visual/Form.js</a>, <a href="visual_Form.js.html#line218">line 218</a>
</li></ul></dd>
</dl>
<h4 class="name" id="refresh"><span class="type-signature"></span>refresh<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Force a refresh of the stimulus.
</div>
<dl class="details">
<dt class="tag-overrides">Overrides:</dt>
<dd class="tag-overrides"><ul class="dummy"><li>
<a href="module-visual.VisualStim.html#refresh">module:visual.VisualStim#refresh</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="visual_Form.js.html">visual/Form.js</a>, <a href="visual_Form.js.html#line150">line 150</a>
</li></ul></dd>
</dl>
<h4 class="name" id="reset"><span class="type-signature"></span>reset<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Reset the form.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="visual_Form.js.html">visual/Form.js</a>, <a href="visual_Form.js.html#line256">line 256</a>
</li></ul></dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-core.html">core</a></li><li><a href="module-data.html">data</a></li><li><a href="module-sound.html">sound</a></li><li><a href="module-util.html">util</a></li><li><a href="module-visual.html">visual</a></li></ul><h3>Classes</h3><ul><li><a href="module-core.BuilderKeyResponse.html">BuilderKeyResponse</a></li><li><a href="module-core.EventManager.html">EventManager</a></li><li><a href="module-core.GUI.html">GUI</a></li><li><a href="module-core.Keyboard.html">Keyboard</a></li><li><a href="module-core.KeyPress.html">KeyPress</a></li><li><a href="module-core.Logger.html">Logger</a></li><li><a href="module-core.MinimalStim.html">MinimalStim</a></li><li><a href="module-core.Mouse.html">Mouse</a></li><li><a href="module-core.PsychoJS.html">PsychoJS</a></li><li><a href="module-core.ServerManager.html">ServerManager</a></li><li><a href="module-core.Window.html">Window</a></li><li><a href="module-data.ExperimentHandler.html">ExperimentHandler</a></li><li><a href="module-data.TrialHandler.html">TrialHandler</a></li><li><a href="module-sound.Sound.html">Sound</a></li><li><a href="module-sound.TonePlayer.html">TonePlayer</a></li><li><a href="module-sound.TrackPlayer.html">TrackPlayer</a></li><li><a href="module-util.Clock.html">Clock</a></li><li><a href="module-util.Color.html">Color</a></li><li><a href="module-util.CountdownTimer.html">CountdownTimer</a></li><li><a href="module-util.EventEmitter.html">EventEmitter</a></li><li><a href="module-util.MixinBuilder.html">MixinBuilder</a></li><li><a href="module-util.MonotonicClock.html">MonotonicClock</a></li><li><a href="module-util.PsychObject.html">PsychObject</a></li><li><a href="module-util.Scheduler.html">Scheduler</a></li><li><a href="module-visual.Form.html">Form</a></li><li><a href="module-visual.ImageStim.html">ImageStim</a></li><li><a href="module-visual.MovieStim.html">MovieStim</a></li><li><a href="module-visual.Polygon.html">Polygon</a></li><li><a href="module-visual.Rect.html">Rect</a></li><li><a href="module-visual.ShapeStim.html">ShapeStim</a></li><li><a href="module-visual.Slider.html">Slider</a></li><li><a href="module-visual.TextBox.html">TextBox</a></li><li><a href="module-visual.TextStim.html">TextStim</a></li><li><a href="module-visual.VisualStim.html">VisualStim</a></li><li><a href="TextInput.html">TextInput</a></li></ul><h3>Interfaces</h3><ul><li><a href="module-sound.SoundPlayer.html">SoundPlayer</a></li></ul><h3>Mixins</h3><ul><li><a href="module-core.WindowMixin.html">WindowMixin</a></li><li><a href="module-util.ColorMixin.html">ColorMixin</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Fri Apr 09 2021 14:03:40 GMT+0200 (Central European Summer Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>