new Slider(options)
Slider stimulus.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
- Mixes In:
- Source:
- To Do:
-
- check that parameters are valid, e.g. ticks are an array of numbers, etc.
- readOnly
- complete setters, for instance setTicks should change this._isCategorical
- consider using a proper UI delegate architecture (a la Java Swing, for instance).
Extends
Members
(private) _updateIfNeeded
Update the stimulus, if necessary.
- Source:
(private) _updateMarker
Update the position of the marker if necessary.
- Source:
contains
Determine whether an object is inside the bounding box of the stimulus.
- Overrides:
- Source:
getRating
Get the current value of the rating.
- Source:
getRT
Get the response time of the most recent change to the rating.
- Source:
refresh
Force a refresh of the stimulus.
- Overrides:
- Source:
reset
Reset the slider.
- Source:
setMarkerPos
Setter for the markerPos attribute.
Setting markerPos changes the visible position of the marker to the specified rating but does not change the actual rating returned by the slider.
- Source:
setOri
Setter for the orientation attribute.
- Inherited From:
- Source:
setPos
Setter for the position attribute.
- Inherited From:
- Source:
setRating
Setter for the rating attribute.
Setting the rating does not change the visible position of the marker.
- Source:
setReadOnly
Setter for the readOnly attribute.
Read-only sliders are half-opaque and do not provide responses.
- Source:
setSize
Setter for the size attribute.
- Inherited From:
- Source:
(readonly) Shape :Symbol
Shape of the marker and of the ticks.
Type:
- Symbol
- Source:
(readonly) Style :Symbol
Styles.
Type:
- Symbol
- Source:
Methods
(protected) _estimateBoundingBox()
Estimate the bounding box.
- Overrides:
- Source:
(private) _getTextStyle()
Get the PIXI Text Style applied to the PIXI.Text labels.
- Source:
(private) _granularise(rating) → {number}
Calculate the rating once granularity has been taken into account.
Parameters:
Name | Type | Description |
---|---|---|
rating |
number | the input rating |
- Source:
Returns:
the new rating with granularity applied
- Type
- number
(private) _isHorizontal() → {boolean}
Determine whether the slider is horizontal.
The slider is horizontal is its x-axis size is larger than its y-axis size.
- Source:
Returns:
whether or not the slider is horizontal
- Type
- boolean
(protected) _onChange(withPixiopt, withBoundingBoxopt) → {function}
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 |
- Inherited From:
- Source:
Returns:
- Type
- function
(private) _posToRating(pos_px) → {number}
Convert a [x,y] position, in pixel units, relative to the slider, into a rating.
Parameters:
Name | Type | Description |
---|---|---|
pos_px |
Array.<number> | the [x,y] position, in pixel units, relative to the slider. |
- Source:
Returns:
the corresponding rating.
- Type
- number
(private) _ratingToPos(ratings) → {Array.<Array.<number>>}
Convert an array of ratings into an array of [x,y] positions (in Slider units, with 0 at the center of the Slider)
Parameters:
Name | Type | Description |
---|---|---|
ratings |
Array.<number> | the array of ratings |
- Source:
Returns:
the positions corresponding to the ratings (in Slider units,
with 0 at the center of the Slider)
- Type
- Array.<Array.<number>>
(private) _recordRating(rating, responseTimeopt, logopt)
Set the current rating.
Setting the rating does also change the visible position of the marker.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
rating |
number | the rating | ||
responseTime |
number |
<optional> |
the reaction time | |
log |
boolean |
<optional> |
false | whether of not to log |
- Source:
(protected) _sanitizeAttributes()
Sanitize the slider attributes: check for attribute conflicts, missing values, etc.
- Source:
(private) _setupBar()
Setup the central bar.
- Source:
(private) _setupMarker()
Setup the marker, and the associated mouse events.
- Source:
(private) _setupSlider()
Setup the PIXI components of the slider (bar, ticks, labels, marker, etc.).
- Source:
(private) _setupStyle()
Apply a particular style to the slider.
- Source:
(private) _setupTicks()
Setup the ticks.
- Source:
(private) _setupTicks()
Setup the labels.
- Source:
(private) _updateIfNeeded()
Update the form visual representation, if necessary.
This estimate which stimuli are visible, and updates the decorations.
- Source: