V8: Save the slider default values on the model if no value is set (#4931)

This commit is contained in:
Kenn Jacobsen
2019-04-30 21:19:35 +02:00
committed by Sebastiaan Janssen
parent a822e18719
commit 4df63c7f04

View File

@@ -26,10 +26,6 @@
};
function init() {
// convert to array
$scope.sliderValue = $scope.model.value ? $scope.model.value.split(',') : null;
configureDefaults();
// format config to fit slider plugin
@@ -38,6 +34,14 @@
const tooltips = $scope.model.config.enableRange ? [true, true] : [true];
const min = $scope.model.config.minVal ? [$scope.model.config.minVal] : [$scope.model.config.minVal];
const max = $scope.model.config.maxVal ? [$scope.model.config.maxVal] : [$scope.model.config.maxVal];
// set model.value to the default value if it's not set (but don't trigger setDirty, just silently update with the default value)
if (!$scope.model.value) {
$scope.model.value = start.toString();
}
// convert to array
$scope.sliderValue = $scope.model.value ? $scope.model.value.split(',') : null;
// don't render values with decimal places if the step increment in a whole number
var stepDecimalPlaces = $scope.model.config.step % 1 == 0
? 0