Allow switching property editor from numeric to slider (#11287)

* Make it possible to change from numeric/decimal property editor to slider without breaking editor

* Formatting
This commit is contained in:
Bjarne Fyrstenborg
2021-10-15 03:00:16 +02:00
committed by GitHub
parent 08075e511f
commit 6a5e34b24d

View File

@@ -45,8 +45,13 @@
if (!$scope.model.value) {
$scope.model.value = start.toString();
}
// convert to array
$scope.sliderValue = $scope.model.value ? $scope.model.value.split(',') : null;
// convert to array - exiting value can be a number if switching from numeric/decimal property editor
$scope.sliderValue = $scope.model.value
? Utilities.isString($scope.model.value) || Utilities.isNumber($scope.model.value)
? $scope.model.value.toString().split(',')
: null
: null;
// don't render values with decimal places if the step increment in a whole number
var stepDecimalPlaces = $scope.model.config.step % 1 == 0