Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,20 @@ export const manifest: ManifestPropertyEditorSchema = {
alias: 'minVal',
label: 'Minimum value',
description: '',
propertyEditorUiAlias: 'Umb.PropertyEditorUi.Integer',
propertyEditorUiAlias: 'Umb.PropertyEditorUi.Decimal',
config: [{ alias: 'step', value: '0.001' }],
},
{
alias: 'maxVal',
label: 'Maximum value',
description: '',
propertyEditorUiAlias: 'Umb.PropertyEditorUi.Integer',
propertyEditorUiAlias: 'Umb.PropertyEditorUi.Decimal',
config: [{ alias: 'step', value: '0.001' }],
},
],
defaultData: [
{ alias: 'minVal', value: 0 },
{ alias: 'maxVal', value: 100 },
{ alias: 'minVal', value: 0.0 },
{ alias: 'maxVal', value: 100.0 },
],
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,33 +31,36 @@ export const manifests: Array<UmbExtensionManifest> = [
alias: 'initVal1',
label: 'Initial value',
description: '',
propertyEditorUiAlias: 'Umb.PropertyEditorUi.Integer',
propertyEditorUiAlias: 'Umb.PropertyEditorUi.Decimal',
config: [{ alias: 'step', value: '0.001' }],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great PR. But is it safe to assume that having 3 decimals is enough to cover all cases?
I'm not sure, but I will leave this thought up for those reviewing( or something with oppinions coming by)

},
{
alias: 'initVal2',
label: 'Initial value 2',
description: 'Used when range is enabled',
propertyEditorUiAlias: 'Umb.PropertyEditorUi.Integer',
propertyEditorUiAlias: 'Umb.PropertyEditorUi.Decimal',
config: [{ alias: 'step', value: '0.001' }],
},
{
alias: 'step',
label: 'Step increments',
description: '',
propertyEditorUiAlias: 'Umb.PropertyEditorUi.Integer',
propertyEditorUiAlias: 'Umb.PropertyEditorUi.Decimal',
config: [{ alias: 'step', value: '0.001' }],
},
],
defaultData: [
{
alias: 'initVal1',
value: 0,
value: 0.0,
},
{
alias: 'initVal2',
value: 0,
value: 0.0,
},
{
alias: 'step',
value: 1,
value: 1.0,
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ export class UmbPropertyEditorUISliderElement
const initVal2 = Number(config.getValueByAlias('initVal2'));
this._initVal2 = isNaN(initVal2) ? this._initVal1 + this._step : initVal2;

this._min = this.#parseInt(config.getValueByAlias('minVal')) || 0;
this._max = this.#parseInt(config.getValueByAlias('maxVal')) || 100;
this._min = this.#parseNumber(config.getValueByAlias('minVal')) || 0;
this._max = this.#parseNumber(config.getValueByAlias('maxVal')) || 100;

if (this._min === this._max) {
this._max = this._min + 100;
Expand Down Expand Up @@ -137,9 +137,9 @@ export class UmbPropertyEditorUISliderElement
}
}

#parseInt(input: unknown): number | undefined {
#parseNumber(input: unknown): number | undefined {
const num = Number(input);
return Number.isNaN(num) ? undefined : num;
return Number.isFinite(num) ? undefined : num;
}

#onChange(event: CustomEvent & { target: UmbInputSliderElement }) {
Expand Down
Loading