Slider property editor: Fix for preset value handling of enableRange (#20772)
Fix config value access in UmbSliderPropertyValuePreset Updated the `UmbSliderPropertyValuePreset` class to ensure the `.value` property is accessed for configuration items. This change improves the accuracy of retrieving `enableRange`, `min`, `max`, and `step` values, addressing potential bugs in value processing. Co-authored-by: Luuk Peters <Luuk.Peters@proudnerds.com>
This commit is contained in:
@@ -6,16 +6,16 @@ export class UmbSliderPropertyValuePreset
|
||||
implements UmbPropertyValuePreset<UmbSliderPropertyEditorUiValue, UmbPropertyEditorConfig>
|
||||
{
|
||||
async processValue(value: undefined | UmbSliderPropertyEditorUiValue, config: UmbPropertyEditorConfig) {
|
||||
const enableRange = Boolean(config.find((x) => x.alias === 'enableRange') ?? false);
|
||||
const enableRange = Boolean(config.find((x) => x.alias === 'enableRange')?.value ?? false);
|
||||
|
||||
/*
|
||||
const min = Number(config.find((x) => x.alias === 'minVal') ?? 0);
|
||||
const max = Number(config.find((x) => x.alias === 'maxVal') ?? 100);
|
||||
const min = Number(config.find((x) => x.alias === 'minVal')?.value ?? 0);
|
||||
const max = Number(config.find((x) => x.alias === 'maxVal')?.value ?? 100);
|
||||
const minVerified = isNaN(min) ? undefined : min;
|
||||
const maxVerified = isNaN(max) ? undefined : max;
|
||||
*/
|
||||
|
||||
const step = (config.find((x) => x.alias === 'step') as number | undefined) ?? 0;
|
||||
const step = Number(config.find((x) => x.alias === 'step')?.value ?? 0);
|
||||
const stepVerified = step > 0 ? step : 1;
|
||||
|
||||
const initValueMin = Number(config.find((x) => x.alias === 'initVal1')?.value) || 0;
|
||||
|
||||
Reference in New Issue
Block a user