Skip to content

Commit

Permalink
Fix: added default attribute values for _scaleStart, _scaleEnd an…
Browse files Browse the repository at this point in the history
…d `_scaleStep`. Changed `_scaleEnd` schema default from 1 to 10. (fixes #204).
  • Loading branch information
danielghost committed May 21, 2024
1 parent 4e21470 commit 0230587
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ guide the learner’s interaction with the component.

**labelEnd** (string): Text/characters that appear at the end of the slider scale.

**\_scaleStart** (number): This value is the numeric start of the scale. It is used to calculate the slider's position on the scale.
**\_scaleStart** (number): This value is the numeric start of the scale. It is used to calculate the slider's position on the scale. The default is `1`.

**\_scaleEnd** (number): This value is the numeric end of the scale. It is used to calculate the slider's position on the scale.
**\_scaleEnd** (number): This value is the numeric end of the scale. It is used to calculate the slider's position on the scale. The default is `10`.

**\_scaleStep** (number): Defines the amount the scale should be incremented by.
**\_scaleStep** (number): Defines the amount the scale should be incremented by. The default is `1`.

**scaleStepPrefix** (string): Prefix to add to each slider step. For example, a "$" can be used as a prefix to indicate currency in dollars (ex. $100).

Expand Down
3 changes: 3 additions & 0 deletions js/SliderModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ export default class SliderModel extends QuestionModel {

defaults() {
return QuestionModel.resultExtend('defaults', {
_scaleStart: 1,
_scaleEnd: 10,
_scaleStep: 1,
_showScale: true,
_showScaleNumbers: true,
_showScaleIndicator: true,
Expand Down
2 changes: 1 addition & 1 deletion properties.schema
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
"_scaleEnd": {
"type": "number",
"required": true,
"default": 1,
"default": 10,
"title": "Scale End",
"inputType": "Number",
"validators": ["required", "number"],
Expand Down
2 changes: 1 addition & 1 deletion schema/component.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
"_scaleEnd": {
"type": "number",
"title": "Scale end number",
"default": 1
"default": 10
},
"_scaleStep": {
"type": "number",
Expand Down

0 comments on commit 0230587

Please sign in to comment.