mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-05-29 09:19:53 +02:00
Add support for min/max/step/defaultValue on number field
This commit is contained in:
parent
818339823c
commit
c9ab5c23ea
1 changed files with 17 additions and 0 deletions
|
@ -1533,6 +1533,11 @@ function resetProperties() {
|
||||||
case 'number':
|
case 'number':
|
||||||
case 'string': {
|
case 'string': {
|
||||||
property.elInput.value = "";
|
property.elInput.value = "";
|
||||||
|
if (propertyData.defaultValue !== undefined) {
|
||||||
|
property.elInput.setValue(propertyData.defaultValue);
|
||||||
|
} else {
|
||||||
|
property.elInput.setValue("");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'bool': {
|
case 'bool': {
|
||||||
|
@ -1889,6 +1894,18 @@ function createNumberProperty(property, elProperty) {
|
||||||
${propertyData.readOnly ? 'readonly' : ''}></input>
|
${propertyData.readOnly ? 'readonly' : ''}></input>
|
||||||
`)
|
`)
|
||||||
|
|
||||||
|
if (propertyData.min !== undefined) {
|
||||||
|
elInput.setAttribute("min", propertyData.min);
|
||||||
|
}
|
||||||
|
if (propertyData.max !== undefined) {
|
||||||
|
elInput.setAttribute("max", propertyData.max);
|
||||||
|
}
|
||||||
|
if (propertyData.step !== undefined) {
|
||||||
|
elInput.setAttribute("step", propertyData.step);
|
||||||
|
}
|
||||||
|
if (propertyData.defaultValue !== undefined) {
|
||||||
|
elInput.value = propertyData.defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
elInput.addEventListener('change', createEmitTextPropertyUpdateFunction(property));
|
elInput.addEventListener('change', createEmitTextPropertyUpdateFunction(property));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue