This commit is contained in:
Mirco Wittrien 2020-09-07 14:00:02 +02:00
parent 021d6f6e17
commit d288da3de7
2 changed files with 3 additions and 5 deletions

View File

@ -9358,7 +9358,6 @@
InternalComponents.LibraryComponents.Slider = InternalBDFDB.loadPatchedComp("Slider") || reactInitialized && class BDFDB_Slider extends LibraryModules.React.Component {
handleValueChange(value) {
let newValue = BDFDB.NumberUtils.mapRange([0, 100], this.props.edges, value);
console.log(this.props, value, newValue);
if (typeof this.props.digits == "number") newValue = Math.round(newValue * Math.pow(10, this.props.digits)) / Math.pow(10, this.props.digits);
this.props.defaultValue = this.props.value = newValue;
if (typeof this.props.onValueChange == "function") this.props.onValueChange(newValue, this);
@ -9375,9 +9374,7 @@
}
render() {
let value = this.props.value || this.props.defaultValue || 0;
let min = this.props.min || this.props.minValue || 0;
let max = this.props.max || this.props.maxValue || 100;
if (!BDFDB.ArrayUtils.is(this.props.edges) || this.props.edges.length != 2) this.props.edges = [min, max];
if (!BDFDB.ArrayUtils.is(this.props.edges) || this.props.edges.length != 2) this.props.edges = [this.props.min || this.props.minValue || 0, this.props.max || this.props.maxValue || 100];
let defaultValue = BDFDB.NumberUtils.mapRange(this.props.edges, [0, 100], value);
if (typeof this.props.digits == "number") defaultValue = Math.round(defaultValue * Math.pow(10, this.props.digits)) / Math.pow(10, this.props.digits);
return BDFDB.ReactUtils.createElement(InternalComponents.NativeSubComponents.Slider, BDFDB.ObjectUtils.exclude(Object.assign({}, this.props, {
@ -9387,6 +9384,7 @@
}), "digits", "edges", "max", "maxValue", "min", "minValue"));
}
};
InternalBDFDB.setDefaultProps(InternalComponents.LibraryComponents.Slider, {hideBubble:false});
InternalComponents.LibraryComponents.Spinner = BDFDB.ModuleUtils.findByName("Spinner");

File diff suppressed because one or more lines are too long