Skip to content

Commit

Permalink
Allow switching property editor from numeric to slider (#11287)
Browse files Browse the repository at this point in the history
* Make it possible to change from numeric/decimal property editor to slider without breaking editor

* Formatting
  • Loading branch information
bjarnef authored Oct 15, 2021
1 parent 08075e5 commit 6a5e34b
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6a5e34b

Please sign in to comment.