Set step size for numeric input controls.
This commit is contained in:
@@ -11,7 +11,6 @@
|
|||||||
- Channel Routing: configure audio channels as Aux or re-amp channels.
|
- Channel Routing: configure audio channels as Aux or re-amp channels.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## PiPedal 1.5.99 Beta
|
## PiPedal 1.5.99 Beta
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|||||||
@@ -163,6 +163,7 @@ export const NumericInput =
|
|||||||
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
||||||
//const classes = withStyles.getClasses(this.props);
|
//const classes = withStyles.getClasses(this.props);
|
||||||
return (<Input style={{ width: 65 }}
|
return (<Input style={{ width: 65 }}
|
||||||
inputProps={{
|
inputProps={{
|
||||||
|
|||||||
@@ -888,6 +888,14 @@ const PluginControl =
|
|||||||
currentValue: number = 0;
|
currentValue: number = 0;
|
||||||
uiControl?: UiControl = undefined;
|
uiControl?: UiControl = undefined;
|
||||||
|
|
||||||
|
private defaultStep(min: number, max: number): number {
|
||||||
|
let range = Math.abs(max - min);
|
||||||
|
if (range <= 1) return 0.01;
|
||||||
|
if (range <= 10) return 0.1;
|
||||||
|
if (range <= 100) return 1;
|
||||||
|
if (range <= 1000) return 10;
|
||||||
|
return 100;
|
||||||
|
}
|
||||||
render() {
|
render() {
|
||||||
const classes = withStyles.getClasses(this.props);
|
const classes = withStyles.getClasses(this.props);
|
||||||
let t = this.props.uiControl;
|
let t = this.props.uiControl;
|
||||||
@@ -1107,6 +1115,10 @@ const PluginControl =
|
|||||||
|
|
||||||
min: this.props.uiControl?.min_value,
|
min: this.props.uiControl?.min_value,
|
||||||
max: this.props.uiControl?.max_value,
|
max: this.props.uiControl?.max_value,
|
||||||
|
step: this.defaultStep(
|
||||||
|
this.props.uiControl?.min_value ?? 0,
|
||||||
|
this.props.uiControl?.max_value ?? 100
|
||||||
|
)
|
||||||
}}
|
}}
|
||||||
|
|
||||||
sx={{
|
sx={{
|
||||||
|
|||||||
Reference in New Issue
Block a user