From 02305870bd86b3b628cd222b20d7596666625667 Mon Sep 17 00:00:00 2001 From: danielghost Date: Tue, 21 May 2024 14:00:37 +0100 Subject: [PATCH] Fix: added default attribute values for `_scaleStart`, `_scaleEnd` and `_scaleStep`. Changed `_scaleEnd` schema default from 1 to 10. (fixes #204). --- README.md | 6 +++--- js/SliderModel.js | 3 +++ properties.schema | 2 +- schema/component.schema.json | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a882312..976f662 100644 --- a/README.md +++ b/README.md @@ -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). diff --git a/js/SliderModel.js b/js/SliderModel.js index 2417326..3ad4e1e 100644 --- a/js/SliderModel.js +++ b/js/SliderModel.js @@ -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, diff --git a/properties.schema b/properties.schema index 13f105a..3efc93a 100644 --- a/properties.schema +++ b/properties.schema @@ -187,7 +187,7 @@ "_scaleEnd": { "type": "number", "required": true, - "default": 1, + "default": 10, "title": "Scale End", "inputType": "Number", "validators": ["required", "number"], diff --git a/schema/component.schema.json b/schema/component.schema.json index b660cbe..7783a01 100644 --- a/schema/component.schema.json +++ b/schema/component.schema.json @@ -116,7 +116,7 @@ "_scaleEnd": { "type": "number", "title": "Scale end number", - "default": 1 + "default": 10 }, "_scaleStep": { "type": "number",