mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 13:24:02 +02:00
add rect case, fix step rounding
This commit is contained in:
parent
56007c8512
commit
2f99729905
2 changed files with 41 additions and 19 deletions
|
@ -106,7 +106,7 @@ DraggableNumber.prototype = {
|
||||||
|
|
||||||
stepUp: function() {
|
stepUp: function() {
|
||||||
if (!this.isDisabled()) {
|
if (!this.isDisabled()) {
|
||||||
this.elInput.stepUp();
|
this.elInput.value = parseFloat(this.elInput.value) + this.step;
|
||||||
this.inputChange();
|
this.inputChange();
|
||||||
if (this.valueChangeFunction) {
|
if (this.valueChangeFunction) {
|
||||||
this.valueChangeFunction();
|
this.valueChangeFunction();
|
||||||
|
@ -116,7 +116,7 @@ DraggableNumber.prototype = {
|
||||||
|
|
||||||
stepDown: function() {
|
stepDown: function() {
|
||||||
if (!this.isDisabled()) {
|
if (!this.isDisabled()) {
|
||||||
this.elInput.stepDown();
|
this.elInput.value = parseFloat(this.elInput.value) - this.step;
|
||||||
this.inputChange();
|
this.inputChange();
|
||||||
if (this.valueChangeFunction) {
|
if (this.valueChangeFunction) {
|
||||||
this.valueChangeFunction();
|
this.valueChangeFunction();
|
||||||
|
@ -139,6 +139,7 @@ DraggableNumber.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
inputChange: function() {
|
inputChange: function() {
|
||||||
|
console.log("DBACK TEST inputChange1 elInput " + this.elInput.value + " elText " + this.elText.firstChild.data + " min " + this.min + " max " + this.max + " step " + this.step);
|
||||||
let value = this.elInput.value;
|
let value = this.elInput.value;
|
||||||
if (this.max !== undefined) {
|
if (this.max !== undefined) {
|
||||||
value = Math.min(this.max, value);
|
value = Math.min(this.max, value);
|
||||||
|
@ -146,7 +147,9 @@ DraggableNumber.prototype = {
|
||||||
if (this.min !== undefined) {
|
if (this.min !== undefined) {
|
||||||
value = Math.max(this.min, value);
|
value = Math.max(this.min, value);
|
||||||
}
|
}
|
||||||
|
console.log("DBACK TEST inputChange2 elInput " + this.elInput.value + " elText " + this.elText.firstChild.data + " min " + this.min + " max " + this.max + " step " + this.step);
|
||||||
this.setValue(value);
|
this.setValue(value);
|
||||||
|
console.log("DBACK TEST inputChange3 elInput " + this.elInput.value + " elText " + this.elText.firstChild.data + " min " + this.min + " max " + this.max + " step " + this.step);
|
||||||
},
|
},
|
||||||
|
|
||||||
inputBlur: function(ev) {
|
inputBlur: function(ev) {
|
||||||
|
|
|
@ -1947,13 +1947,14 @@ function createNumberProperty(property, elProperty) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateNumberMinMax(property) {
|
function updateNumberMinMax(property) {
|
||||||
let propertyData = property.data;
|
|
||||||
let elInput = property.elInput;
|
let elInput = property.elInput;
|
||||||
if (propertyData.min !== undefined) {
|
let min = property.data.min;
|
||||||
elInput.setAttribute("min", propertyData.min);
|
let max = property.data.max;
|
||||||
|
if (min !== undefined) {
|
||||||
|
elInput.setAttribute("min", min);
|
||||||
}
|
}
|
||||||
if (propertyData.max !== undefined) {
|
if (max !== undefined) {
|
||||||
elInput.setAttribute("max", propertyData.max);
|
elInput.setAttribute("max", max);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2029,6 +2030,15 @@ function createRectProperty(property, elProperty) {
|
||||||
return elResult;
|
return elResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateRectMinMax(property) {
|
||||||
|
let min = property.data.min;
|
||||||
|
let max = property.data.max;
|
||||||
|
property.elNumberX.updateMinMax(min, max);
|
||||||
|
property.elNumberY.updateMinMax(min, max);
|
||||||
|
property.elNumberWidth.updateMinMax(min, max);
|
||||||
|
property.elNumberHeight.updateMinMax(min, max);
|
||||||
|
}
|
||||||
|
|
||||||
function createVec3Property(property, elProperty) {
|
function createVec3Property(property, elProperty) {
|
||||||
let propertyData = property.data;
|
let propertyData = property.data;
|
||||||
|
|
||||||
|
@ -2079,11 +2089,12 @@ function createVec2Property(property, elProperty) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateVectorMinMax(property) {
|
function updateVectorMinMax(property) {
|
||||||
let propertyData = property.data;
|
let min = property.data.min;
|
||||||
property.elNumberX.updateMinMax(propertyData.min, propertyData.max);
|
let max = property.data.max;
|
||||||
property.elNumberY.updateMinMax(propertyData.min, propertyData.max);
|
property.elNumberX.updateMinMax(min, max);
|
||||||
|
property.elNumberY.updateMinMax(min, max);
|
||||||
if (property.elNumberZ) {
|
if (property.elNumberZ) {
|
||||||
property.elNumberZ.updateMinMax(propertyData.min, propertyData.max);
|
property.elNumberZ.updateMinMax(min, max);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3094,7 +3105,7 @@ function loaded() {
|
||||||
properties[propertyID] = property;
|
properties[propertyID] = property;
|
||||||
}
|
}
|
||||||
if (propertyData.type === 'number' || propertyData.type === 'number-draggable' ||
|
if (propertyData.type === 'number' || propertyData.type === 'number-draggable' ||
|
||||||
propertyData.type === 'vec2' || propertyData.type === 'vec3') {
|
propertyData.type === 'vec2' || propertyData.type === 'vec3' || propertyData.type === 'rect') {
|
||||||
propertyRangeRequests.push(propertyID);
|
propertyRangeRequests.push(propertyID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3473,13 +3484,21 @@ function loaded() {
|
||||||
propertyData.max /= multiplier;
|
propertyData.max /= multiplier;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (propertyData.type === 'number') {
|
switch (propertyData.type) {
|
||||||
updateNumberMinMax(properties[property]);
|
case 'number':
|
||||||
} else if (propertyData.type === 'number-draggable') {
|
updateNumberMinMax(properties[property]);
|
||||||
updateNumberDraggableMinMax(properties[property]);
|
break;
|
||||||
} else if (propertyData.type === 'vec2' || propertyData.type === 'vec3') {
|
case 'number-draggable':
|
||||||
updateVectorMinMax(properties[property]);
|
updateNumberDraggableMinMax(properties[property]);
|
||||||
}
|
break;
|
||||||
|
case 'vec3':
|
||||||
|
case 'vec2':
|
||||||
|
updateVectorMinMax(properties[property]);
|
||||||
|
break;
|
||||||
|
case 'rect':
|
||||||
|
updateRectMinMax(properties[property]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue