mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 13:28:09 +02:00
block updates during dragging
This commit is contained in:
parent
484de06cf4
commit
ff6d43d0e4
3 changed files with 150 additions and 82 deletions
|
@ -2223,6 +2223,7 @@ var PropertiesTool = function (opts) {
|
||||||
// are selected or if no entity is selected this will be `null`.
|
// are selected or if no entity is selected this will be `null`.
|
||||||
var currentSelectedEntityID = null;
|
var currentSelectedEntityID = null;
|
||||||
var statusMonitor = null;
|
var statusMonitor = null;
|
||||||
|
var nextPropertyUpdateDisabled = false;
|
||||||
|
|
||||||
that.setVisible = function (newVisible) {
|
that.setVisible = function (newVisible) {
|
||||||
visible = newVisible;
|
visible = newVisible;
|
||||||
|
@ -2260,6 +2261,11 @@ var PropertiesTool = function (opts) {
|
||||||
};
|
};
|
||||||
|
|
||||||
function updateSelections(selectionUpdated) {
|
function updateSelections(selectionUpdated) {
|
||||||
|
if (nextPropertyUpdateDisabled) {
|
||||||
|
nextPropertyUpdateDisabled = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
type: 'update',
|
type: 'update',
|
||||||
spaceMode: selectionDisplay.getSpaceMode()
|
spaceMode: selectionDisplay.getSpaceMode()
|
||||||
|
@ -2356,6 +2362,7 @@ var PropertiesTool = function (opts) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pushCommandForSelections();
|
pushCommandForSelections();
|
||||||
|
nextPropertyUpdateDisabled = data.blockUpdateCallback === true;
|
||||||
selectionManager._update(false, this);
|
selectionManager._update(false, this);
|
||||||
} else if (data.type === 'saveUserData' || data.type === 'saveMaterialData') {
|
} else if (data.type === 'saveUserData' || data.type === 'saveMaterialData') {
|
||||||
//the event bridge and json parsing handle our avatar id string differently.
|
//the event bridge and json parsing handle our avatar id string differently.
|
||||||
|
@ -2466,6 +2473,8 @@ var PropertiesTool = function (opts) {
|
||||||
tooltips: Script.require('./assets/data/createAppTooltips.json'),
|
tooltips: Script.require('./assets/data/createAppTooltips.json'),
|
||||||
hmdActive: HMD.active,
|
hmdActive: HMD.active,
|
||||||
});
|
});
|
||||||
|
} else if (data.type === "updateProperties") {
|
||||||
|
updateSelections(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -8,11 +8,14 @@
|
||||||
|
|
||||||
const DELTA_X_FOCUS_THRESHOLD = 1;
|
const DELTA_X_FOCUS_THRESHOLD = 1;
|
||||||
|
|
||||||
function DraggableNumber(min, max, step, decimals) {
|
function DraggableNumber(min, max, step, decimals, dragStart, dragEnd) {
|
||||||
this.min = min;
|
this.min = min;
|
||||||
this.max = max;
|
this.max = max;
|
||||||
this.step = step !== undefined ? step : 1;
|
this.step = step !== undefined ? step : 1;
|
||||||
this.decimals = decimals;
|
this.decimals = decimals;
|
||||||
|
this.dragStartFunction = dragStart;
|
||||||
|
this.dragEndFunction = dragEnd;
|
||||||
|
this.dragging = false;
|
||||||
this.initialMouseEvent = null;
|
this.initialMouseEvent = null;
|
||||||
this.lastMouseEvent = null;
|
this.lastMouseEvent = null;
|
||||||
this.valueChangeFunction = null;
|
this.valueChangeFunction = null;
|
||||||
|
@ -32,7 +35,7 @@ DraggableNumber.prototype = {
|
||||||
mouseUp: function(event) {
|
mouseUp: function(event) {
|
||||||
if (event.target === this.elText && this.initialMouseEvent) {
|
if (event.target === this.elText && this.initialMouseEvent) {
|
||||||
let dx = event.clientX - this.initialMouseEvent.clientX;
|
let dx = event.clientX - this.initialMouseEvent.clientX;
|
||||||
if (dx <= DELTA_X_FOCUS_THRESHOLD) {
|
if (Math.abs(dx) <= DELTA_X_FOCUS_THRESHOLD) {
|
||||||
this.elInput.style.visibility = "visible";
|
this.elInput.style.visibility = "visible";
|
||||||
this.elText.style.visibility = "hidden";
|
this.elText.style.visibility = "hidden";
|
||||||
}
|
}
|
||||||
|
@ -41,22 +44,32 @@ DraggableNumber.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
documentMouseMove: function(event) {
|
documentMouseMove: function(event) {
|
||||||
if (this.lastMouseEvent) {
|
if (this.initialMouseEvent) {
|
||||||
let initialValue = this.elInput.value;
|
let dxFromInitial = event.clientX - this.initialMouseEvent.clientX;
|
||||||
let dx = event.clientX - this.lastMouseEvent.clientX;
|
if (Math.abs(dxFromInitial) > DELTA_X_FOCUS_THRESHOLD && this.lastMouseEvent) {
|
||||||
let changeValue = dx !== 0;
|
let initialValue = this.elInput.value;
|
||||||
if (changeValue) {
|
let dx = event.clientX - this.lastMouseEvent.clientX;
|
||||||
while (dx !== 0) {
|
let changeValue = dx !== 0;
|
||||||
if (dx > 0) {
|
if (changeValue) {
|
||||||
this.stepUp();
|
while (dx !== 0) {
|
||||||
--dx;
|
if (dx > 0) {
|
||||||
} else {
|
this.elInput.stepUp();
|
||||||
this.stepDown();
|
--dx;
|
||||||
++dx;
|
} else {
|
||||||
|
this.elInput.stepDown();
|
||||||
|
++dx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.inputChange();
|
||||||
|
if (this.valueChangeFunction) {
|
||||||
|
this.valueChangeFunction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.valueChangeFunction) {
|
if (!this.dragging) {
|
||||||
this.valueChangeFunction();
|
if (this.dragStartFunction) {
|
||||||
|
this.dragStartFunction();
|
||||||
|
}
|
||||||
|
this.dragging = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.lastMouseEvent = event;
|
this.lastMouseEvent = event;
|
||||||
|
@ -64,6 +77,12 @@ DraggableNumber.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
documentMouseUp: function(event) {
|
documentMouseUp: function(event) {
|
||||||
|
if (this.dragging) {
|
||||||
|
if (this.dragEndFunction) {
|
||||||
|
this.dragEndFunction();
|
||||||
|
}
|
||||||
|
this.dragging = false;
|
||||||
|
}
|
||||||
this.lastMouseEvent = null;
|
this.lastMouseEvent = null;
|
||||||
document.removeEventListener("mousemove", this.onDocumentMouseMove);
|
document.removeEventListener("mousemove", this.onDocumentMouseMove);
|
||||||
document.removeEventListener("mouseup", this.onDocumentMouseUp);
|
document.removeEventListener("mouseup", this.onDocumentMouseUp);
|
||||||
|
@ -72,11 +91,17 @@ DraggableNumber.prototype = {
|
||||||
stepUp: function() {
|
stepUp: function() {
|
||||||
this.elInput.stepUp();
|
this.elInput.stepUp();
|
||||||
this.inputChange();
|
this.inputChange();
|
||||||
|
if (this.valueChangeFunction) {
|
||||||
|
this.valueChangeFunction();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
stepDown: function() {
|
stepDown: function() {
|
||||||
this.elInput.stepDown();
|
this.elInput.stepDown();
|
||||||
this.inputChange();
|
this.inputChange();
|
||||||
|
if (this.valueChangeFunction) {
|
||||||
|
this.valueChangeFunction();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setValue: function(newValue) {
|
setValue: function(newValue) {
|
||||||
|
|
|
@ -1636,7 +1636,7 @@ function updateVisibleSpaceModeProperties() {
|
||||||
* PROPERTY UPDATE FUNCTIONS
|
* PROPERTY UPDATE FUNCTIONS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function updateProperty(originalPropertyName, propertyValue, isParticleProperty) {
|
function updateProperty(originalPropertyName, propertyValue, isParticleProperty, blockUpdateCallback) {
|
||||||
let propertyUpdate = {};
|
let propertyUpdate = {};
|
||||||
// if this is a compound property name (i.e. animation.running) then split it by . up to 3 times
|
// if this is a compound property name (i.e. animation.running) then split it by . up to 3 times
|
||||||
let splitPropertyName = originalPropertyName.split('.');
|
let splitPropertyName = originalPropertyName.split('.');
|
||||||
|
@ -1662,7 +1662,7 @@ function updateProperty(originalPropertyName, propertyValue, isParticleProperty)
|
||||||
});
|
});
|
||||||
particleSyncDebounce();
|
particleSyncDebounce();
|
||||||
} else {
|
} else {
|
||||||
updateProperties(propertyUpdate);
|
updateProperties(propertyUpdate, blockUpdateCallback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1671,66 +1671,89 @@ var particleSyncDebounce = _.debounce(function () {
|
||||||
particlePropertyUpdates = {};
|
particlePropertyUpdates = {};
|
||||||
}, DEBOUNCE_TIMEOUT);
|
}, DEBOUNCE_TIMEOUT);
|
||||||
|
|
||||||
function updateProperties(propertiesToUpdate) {
|
function updateProperties(propertiesToUpdate, blockUpdateCallback) {
|
||||||
|
if (blockUpdateCallback === undefined) {
|
||||||
|
blockUpdateCallback = false;
|
||||||
|
}
|
||||||
EventBridge.emitWebEvent(JSON.stringify({
|
EventBridge.emitWebEvent(JSON.stringify({
|
||||||
id: lastEntityID,
|
id: lastEntityID,
|
||||||
type: "update",
|
type: "update",
|
||||||
properties: propertiesToUpdate
|
properties: propertiesToUpdate,
|
||||||
|
blockUpdateCallback: blockUpdateCallback
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
function createEmitTextPropertyUpdateFunction(propertyName, isParticleProperty) {
|
function createEmitTextPropertyUpdateFunction(property) {
|
||||||
return function() {
|
return function() {
|
||||||
updateProperty(propertyName, this.value, isParticleProperty);
|
updateProperty(property.name, this.value, property.isParticleProperty);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function createEmitCheckedPropertyUpdateFunction(propertyName, inverse, isParticleProperty) {
|
function createEmitCheckedPropertyUpdateFunction(property) {
|
||||||
return function() {
|
return function() {
|
||||||
updateProperty(propertyName, inverse ? !this.checked : this.checked, isParticleProperty);
|
updateProperty(property.name, property.data.inverse ? !this.checked : this.checked, property.isParticleProperty);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function createEmitNumberPropertyUpdateFunction(propertyName, multiplier, isParticleProperty) {
|
function createDragStartFunction(property) {
|
||||||
return function() {
|
return function() {
|
||||||
|
property.dragging = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function createDragEndFunction(property) {
|
||||||
|
return function() {
|
||||||
|
property.dragging = false;
|
||||||
|
EventBridge.emitWebEvent(JSON.stringify({
|
||||||
|
type: "updateProperties"
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function createEmitNumberPropertyUpdateFunction(property) {
|
||||||
|
return function() {
|
||||||
|
let multiplier = property.data.multiplier;
|
||||||
if (multiplier === undefined) {
|
if (multiplier === undefined) {
|
||||||
multiplier = 1;
|
multiplier = 1;
|
||||||
}
|
}
|
||||||
let value = parseFloat(this.value) * multiplier;
|
let value = parseFloat(this.value) * multiplier;
|
||||||
updateProperty(propertyName, value, isParticleProperty);
|
updateProperty(property.name, value, property.isParticleProperty, property.dragging);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function createEmitVec2PropertyUpdateFunction(propertyName, elX, elY, multiplier, isParticleProperty) {
|
function createEmitVec2PropertyUpdateFunction(property) {
|
||||||
return function () {
|
return function () {
|
||||||
|
let multiplier = property.data.multiplier;
|
||||||
if (multiplier === undefined) {
|
if (multiplier === undefined) {
|
||||||
multiplier = 1;
|
multiplier = 1;
|
||||||
}
|
}
|
||||||
let newValue = {
|
let newValue = {
|
||||||
x: elX.value * multiplier,
|
x: property.elNumberX.elInput.value * multiplier,
|
||||||
y: elY.value * multiplier
|
y: property.elNumberY.elInput.value * multiplier
|
||||||
};
|
};
|
||||||
updateProperty(propertyName, newValue, isParticleProperty);
|
updateProperty(property.name, newValue, property.isParticleProperty, property.dragging);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function createEmitVec3PropertyUpdateFunction(propertyName, elX, elY, elZ, multiplier, isParticleProperty) {
|
function createEmitVec3PropertyUpdateFunction(property) {
|
||||||
return function() {
|
return function() {
|
||||||
|
let multiplier = property.data.multiplier;
|
||||||
if (multiplier === undefined) {
|
if (multiplier === undefined) {
|
||||||
multiplier = 1;
|
multiplier = 1;
|
||||||
}
|
}
|
||||||
let newValue = {
|
let newValue = {
|
||||||
x: elX.value * multiplier,
|
x: property.elNumberX.elInput.value * multiplier,
|
||||||
y: elY.value * multiplier,
|
y: property.elNumberY.elInput.value * multiplier,
|
||||||
z: elZ.value * multiplier
|
z: property.elNumberZ.elInput.value * multiplier
|
||||||
};
|
};
|
||||||
updateProperty(propertyName, newValue, isParticleProperty);
|
updateProperty(property.name, newValue, property.isParticleProperty, property.dragging);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function createEmitColorPropertyUpdateFunction(propertyName, elRed, elGreen, elBlue, isParticleProperty) {
|
function createEmitColorPropertyUpdateFunction(property) {
|
||||||
return function() {
|
return function() {
|
||||||
emitColorPropertyUpdate(propertyName, elRed.value, elGreen.value, elBlue.value, isParticleProperty);
|
emitColorPropertyUpdate(property.name, property.elNumberR.elInput.value, property.elNumberG.elInput.value,
|
||||||
|
property.elNumberB.elInput.value, property.isParticleProperty);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1755,10 +1778,10 @@ function updateCheckedSubProperty(propertyName, propertyValue, subPropertyElemen
|
||||||
updateProperty(propertyName, propertyValue, isParticleProperty);
|
updateProperty(propertyName, propertyValue, isParticleProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
function createImageURLUpdateFunction(propertyName, isParticleProperty) {
|
function createImageURLUpdateFunction(property) {
|
||||||
return function () {
|
return function () {
|
||||||
let newTextures = JSON.stringify({ "tex.picture": this.value });
|
let newTextures = JSON.stringify({ "tex.picture": this.value });
|
||||||
updateProperty(propertyName, newTextures, isParticleProperty);
|
updateProperty(property.name, newTextures, property.isParticleProperty);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1768,7 +1791,6 @@ function createImageURLUpdateFunction(propertyName, isParticleProperty) {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function createStringProperty(property, elProperty) {
|
function createStringProperty(property, elProperty) {
|
||||||
let propertyName = property.name;
|
|
||||||
let elementID = property.elementID;
|
let elementID = property.elementID;
|
||||||
let propertyData = property.data;
|
let propertyData = property.data;
|
||||||
|
|
||||||
|
@ -1782,7 +1804,7 @@ function createStringProperty(property, elProperty) {
|
||||||
`)
|
`)
|
||||||
|
|
||||||
|
|
||||||
elInput.addEventListener('change', createEmitTextPropertyUpdateFunction(propertyName, property.isParticleProperty));
|
elInput.addEventListener('change', createEmitTextPropertyUpdateFunction(property));
|
||||||
|
|
||||||
elProperty.appendChild(elInput);
|
elProperty.appendChild(elInput);
|
||||||
|
|
||||||
|
@ -1821,30 +1843,30 @@ function createBoolProperty(property, elProperty) {
|
||||||
elInput, propertyName, property.isParticleProperty);
|
elInput, propertyName, property.isParticleProperty);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
elInput.addEventListener('change', createEmitCheckedPropertyUpdateFunction(propertyName, propertyData.inverse,
|
elInput.addEventListener('change', createEmitCheckedPropertyUpdateFunction(property));
|
||||||
property.isParticleProperty));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return elInput;
|
return elInput;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createNumberProperty(property, elProperty) {
|
function createNumberProperty(property, elProperty) {
|
||||||
let propertyName = property.name;
|
|
||||||
let elementID = property.elementID;
|
let elementID = property.elementID;
|
||||||
let propertyData = property.data;
|
let propertyData = property.data;
|
||||||
|
|
||||||
elProperty.className = "draggable-number";
|
elProperty.className = "draggable-number";
|
||||||
|
|
||||||
let elDraggableNumber = new DraggableNumber(propertyData.min, propertyData.max,
|
let dragStartFunction = createDragStartFunction(property);
|
||||||
propertyData.step, propertyData.decimals);
|
let dragEndFunction = createDragEndFunction(property);
|
||||||
|
|
||||||
|
let elDraggableNumber = new DraggableNumber(propertyData.min, propertyData.max, propertyData.step,
|
||||||
|
propertyData.decimals, dragStartFunction, dragEndFunction);
|
||||||
|
|
||||||
let defaultValue = propertyData.defaultValue;
|
let defaultValue = propertyData.defaultValue;
|
||||||
if (defaultValue !== undefined) {
|
if (defaultValue !== undefined) {
|
||||||
elDraggableNumber.elInput.value = defaultValue;
|
elDraggableNumber.elInput.value = defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let valueChangeFunction = createEmitNumberPropertyUpdateFunction(propertyName, propertyData.multiplier,
|
let valueChangeFunction = createEmitNumberPropertyUpdateFunction(property);
|
||||||
property.isParticleProperty);
|
|
||||||
elDraggableNumber.setValueChangeFunction(valueChangeFunction);
|
elDraggableNumber.setValueChangeFunction(valueChangeFunction);
|
||||||
|
|
||||||
elDraggableNumber.elInput.setAttribute("id", elementID);
|
elDraggableNumber.elInput.setAttribute("id", elementID);
|
||||||
|
@ -1858,22 +1880,18 @@ function createNumberProperty(property, elProperty) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function createVec3Property(property, elProperty) {
|
function createVec3Property(property, elProperty) {
|
||||||
let propertyName = property.name;
|
|
||||||
let elementID = property.elementID;
|
|
||||||
let propertyData = property.data;
|
let propertyData = property.data;
|
||||||
|
|
||||||
elProperty.className = propertyData.vec3Type + " fstuple";
|
elProperty.className = propertyData.vec3Type + " fstuple";
|
||||||
|
|
||||||
let elNumberX = createTupleNumberInput(elProperty, elementID, propertyData.subLabels[VECTOR_ELEMENTS.X_NUMBER],
|
let elNumberX = createTupleNumberInput(property, propertyData.subLabels[VECTOR_ELEMENTS.X_NUMBER]);
|
||||||
propertyData.min, propertyData.max, propertyData.step, propertyData.decimals);
|
let elNumberY = createTupleNumberInput(property, propertyData.subLabels[VECTOR_ELEMENTS.Y_NUMBER]);
|
||||||
let elNumberY = createTupleNumberInput(elProperty, elementID, propertyData.subLabels[VECTOR_ELEMENTS.Y_NUMBER],
|
let elNumberZ = createTupleNumberInput(property, propertyData.subLabels[VECTOR_ELEMENTS.Z_NUMBER]);
|
||||||
propertyData.min, propertyData.max, propertyData.step, propertyData.decimals);
|
elProperty.appendChild(elNumberX.elDiv);
|
||||||
let elNumberZ = createTupleNumberInput(elProperty, elementID, propertyData.subLabels[VECTOR_ELEMENTS.Z_NUMBER],
|
elProperty.appendChild(elNumberY.elDiv);
|
||||||
propertyData.min, propertyData.max, propertyData.step, propertyData.decimals);
|
elProperty.appendChild(elNumberZ.elDiv);
|
||||||
|
|
||||||
let valueChangeFunction = createEmitVec3PropertyUpdateFunction(propertyName, elNumberX.elInput, elNumberY.elInput,
|
let valueChangeFunction = createEmitVec3PropertyUpdateFunction(property);
|
||||||
elNumberZ.elInput, propertyData.multiplier,
|
|
||||||
property.isParticleProperty);
|
|
||||||
elNumberX.setValueChangeFunction(valueChangeFunction);
|
elNumberX.setValueChangeFunction(valueChangeFunction);
|
||||||
elNumberY.setValueChangeFunction(valueChangeFunction);
|
elNumberY.setValueChangeFunction(valueChangeFunction);
|
||||||
elNumberZ.setValueChangeFunction(valueChangeFunction);
|
elNumberZ.setValueChangeFunction(valueChangeFunction);
|
||||||
|
@ -1886,8 +1904,6 @@ function createVec3Property(property, elProperty) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function createVec2Property(property, elProperty) {
|
function createVec2Property(property, elProperty) {
|
||||||
let propertyName = property.name;
|
|
||||||
let elementID = property.elementID;
|
|
||||||
let propertyData = property.data;
|
let propertyData = property.data;
|
||||||
|
|
||||||
elProperty.className = propertyData.vec2Type + " fstuple";
|
elProperty.className = propertyData.vec2Type + " fstuple";
|
||||||
|
@ -1897,13 +1913,15 @@ function createVec2Property(property, elProperty) {
|
||||||
|
|
||||||
elProperty.appendChild(elTuple);
|
elProperty.appendChild(elTuple);
|
||||||
|
|
||||||
let elNumberX = createTupleNumberInput(elProperty, elementID, propertyData.subLabels[VECTOR_ELEMENTS.X_NUMBER],
|
let dragStartFunction = createDragStartFunction(property);
|
||||||
propertyData.min, propertyData.max, propertyData.step, propertyData.decimals);
|
let dragEndFunction = createDragEndFunction(property);
|
||||||
let elNumberY = createTupleNumberInput(elProperty, elementID, propertyData.subLabels[VECTOR_ELEMENTS.Y_NUMBER],
|
|
||||||
propertyData.min, propertyData.max, propertyData.step, propertyData.decimals);
|
|
||||||
|
|
||||||
let valueChangeFunction = createEmitVec2PropertyUpdateFunction(propertyName, elNumberX.elInput, elNumberY.elInput,
|
let elNumberX = createTupleNumberInput(property, propertyData.subLabels[VECTOR_ELEMENTS.X_NUMBER]);
|
||||||
propertyData.multiplier, property.isParticleProperty);
|
let elNumberY = createTupleNumberInput(property, propertyData.subLabels[VECTOR_ELEMENTS.Y_NUMBER]);
|
||||||
|
elProperty.appendChild(elNumberX.elDiv);
|
||||||
|
elProperty.appendChild(elNumberY.elDiv);
|
||||||
|
|
||||||
|
let valueChangeFunction = createEmitVec2PropertyUpdateFunction(property);
|
||||||
elNumberX.setValueChangeFunction(valueChangeFunction);
|
elNumberX.setValueChangeFunction(valueChangeFunction);
|
||||||
elNumberY.setValueChangeFunction(valueChangeFunction);
|
elNumberY.setValueChangeFunction(valueChangeFunction);
|
||||||
|
|
||||||
|
@ -1916,6 +1934,7 @@ function createVec2Property(property, elProperty) {
|
||||||
function createColorProperty(property, elProperty) {
|
function createColorProperty(property, elProperty) {
|
||||||
let propertyName = property.name;
|
let propertyName = property.name;
|
||||||
let elementID = property.elementID;
|
let elementID = property.elementID;
|
||||||
|
let propertyData = property.data;
|
||||||
|
|
||||||
elProperty.className = "rgb fstuple";
|
elProperty.className = "rgb fstuple";
|
||||||
|
|
||||||
|
@ -1929,12 +1948,24 @@ function createColorProperty(property, elProperty) {
|
||||||
elProperty.appendChild(elColorPicker);
|
elProperty.appendChild(elColorPicker);
|
||||||
elProperty.appendChild(elTuple);
|
elProperty.appendChild(elTuple);
|
||||||
|
|
||||||
let elNumberR = createTupleNumberInput(elTuple, elementID, "red", COLOR_MIN, COLOR_MAX, COLOR_STEP);
|
if (propertyData.min === undefined) {
|
||||||
let elNumberG = createTupleNumberInput(elTuple, elementID, "green", COLOR_MIN, COLOR_MAX, COLOR_STEP);
|
propertyData.min = COLOR_MIN;
|
||||||
let elNumberB = createTupleNumberInput(elTuple, elementID, "blue", COLOR_MIN, COLOR_MAX, COLOR_STEP);
|
}
|
||||||
|
if (propertyData.max === undefined) {
|
||||||
|
propertyData.max = COLOR_MAX;
|
||||||
|
}
|
||||||
|
if (propertyData.step === undefined) {
|
||||||
|
propertyData.step = COLOR_STEP;
|
||||||
|
}
|
||||||
|
|
||||||
let valueChangeFunction = createEmitColorPropertyUpdateFunction(propertyName, elNumberR.elInput, elNumberG.elInput,
|
let elNumberR = createTupleNumberInput(property, "red");
|
||||||
elNumberB.elInput, property.isParticleProperty);
|
let elNumberG = createTupleNumberInput(property, "green");
|
||||||
|
let elNumberB = createTupleNumberInput(property, "blue");
|
||||||
|
elTuple.appendChild(elNumberR.elDiv);
|
||||||
|
elTuple.appendChild(elNumberG.elDiv);
|
||||||
|
elTuple.appendChild(elNumberB.elDiv);
|
||||||
|
|
||||||
|
let valueChangeFunction = createEmitColorPropertyUpdateFunction(property);
|
||||||
elNumberR.setValueChangeFunction(valueChangeFunction);
|
elNumberR.setValueChangeFunction(valueChangeFunction);
|
||||||
elNumberG.setValueChangeFunction(valueChangeFunction);
|
elNumberG.setValueChangeFunction(valueChangeFunction);
|
||||||
elNumberB.setValueChangeFunction(valueChangeFunction);
|
elNumberB.setValueChangeFunction(valueChangeFunction);
|
||||||
|
@ -1973,7 +2004,6 @@ function createColorProperty(property, elProperty) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function createDropdownProperty(property, propertyID, elProperty) {
|
function createDropdownProperty(property, propertyID, elProperty) {
|
||||||
let propertyName = property.name;
|
|
||||||
let elementID = property.elementID;
|
let elementID = property.elementID;
|
||||||
let propertyData = property.data;
|
let propertyData = property.data;
|
||||||
|
|
||||||
|
@ -1990,7 +2020,7 @@ function createDropdownProperty(property, propertyID, elProperty) {
|
||||||
elInput.add(option);
|
elInput.add(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
elInput.addEventListener('change', createEmitTextPropertyUpdateFunction(propertyName, property.isParticleProperty));
|
elInput.addEventListener('change', createEmitTextPropertyUpdateFunction(property));
|
||||||
|
|
||||||
elProperty.appendChild(elInput);
|
elProperty.appendChild(elInput);
|
||||||
|
|
||||||
|
@ -1998,7 +2028,6 @@ function createDropdownProperty(property, propertyID, elProperty) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function createTextareaProperty(property, elProperty) {
|
function createTextareaProperty(property, elProperty) {
|
||||||
let propertyName = property.name;
|
|
||||||
let elementID = property.elementID;
|
let elementID = property.elementID;
|
||||||
let propertyData = property.data;
|
let propertyData = property.data;
|
||||||
|
|
||||||
|
@ -2010,7 +2039,7 @@ function createTextareaProperty(property, elProperty) {
|
||||||
elInput.readOnly = true;
|
elInput.readOnly = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
elInput.addEventListener('change', createEmitTextPropertyUpdateFunction(propertyName, property.isParticleProperty));
|
elInput.addEventListener('change', createEmitTextPropertyUpdateFunction(property));
|
||||||
|
|
||||||
elProperty.appendChild(elInput);
|
elProperty.appendChild(elInput);
|
||||||
|
|
||||||
|
@ -2102,7 +2131,10 @@ function createButtonsProperty(property, elProperty, elLabel) {
|
||||||
return elProperty;
|
return elProperty;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createTupleNumberInput(elTuple, propertyElementID, subLabel, min, max, step, decimals) {
|
function createTupleNumberInput(property, subLabel) {
|
||||||
|
let propertyElementID = property.elementID;
|
||||||
|
let propertyData = property.data;
|
||||||
|
|
||||||
let elementID = propertyElementID + "-" + subLabel.toLowerCase();
|
let elementID = propertyElementID + "-" + subLabel.toLowerCase();
|
||||||
|
|
||||||
let elLabel = document.createElement('label');
|
let elLabel = document.createElement('label');
|
||||||
|
@ -2111,11 +2143,13 @@ function createTupleNumberInput(elTuple, propertyElementID, subLabel, min, max,
|
||||||
elLabel.setAttribute("for", elementID);
|
elLabel.setAttribute("for", elementID);
|
||||||
elLabel.style.visibility = "visible";
|
elLabel.style.visibility = "visible";
|
||||||
|
|
||||||
let elDraggableNumber = new DraggableNumber(min, max, step, decimals);
|
let dragStartFunction = createDragStartFunction(property);
|
||||||
|
let dragEndFunction = createDragEndFunction(property);
|
||||||
|
let elDraggableNumber = new DraggableNumber(propertyData.min, propertyData.max, propertyData.step,
|
||||||
|
propertyData.decimals, dragStartFunction, dragEndFunction);
|
||||||
elDraggableNumber.elInput.setAttribute("id", elementID);
|
elDraggableNumber.elInput.setAttribute("id", elementID);
|
||||||
elDraggableNumber.elDiv.className += " fstuple";
|
elDraggableNumber.elDiv.className += " fstuple";
|
||||||
elDraggableNumber.elText.insertBefore(elLabel, elDraggableNumber.elLeftArrow);
|
elDraggableNumber.elText.insertBefore(elLabel, elDraggableNumber.elLeftArrow);
|
||||||
elTuple.appendChild(elDraggableNumber.elDiv);
|
|
||||||
|
|
||||||
return elDraggableNumber;
|
return elDraggableNumber;
|
||||||
}
|
}
|
||||||
|
@ -2388,7 +2422,7 @@ function multiDataUpdater(groupName, updateKeyPair, userDataElement, defaults, r
|
||||||
|
|
||||||
userDataElement.value = propertyUpdate.userData;
|
userDataElement.value = propertyUpdate.userData;
|
||||||
|
|
||||||
updateProperties(propertyUpdate);
|
updateProperties(propertyUpdate, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
var editor = null;
|
var editor = null;
|
||||||
|
@ -3306,7 +3340,7 @@ function loaded() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
getPropertyInputElement("image").addEventListener('change', createImageURLUpdateFunction('textures', false));
|
getPropertyInputElement("image").addEventListener('change', createImageURLUpdateFunction(properties['textures']));
|
||||||
|
|
||||||
// Collapsible sections
|
// Collapsible sections
|
||||||
let elCollapsible = document.getElementsByClassName("section-header");
|
let elCollapsible = document.getElementsByClassName("section-header");
|
||||||
|
@ -3401,7 +3435,7 @@ function loaded() {
|
||||||
let propertyID = elDropdown.getAttribute("propertyID");
|
let propertyID = elDropdown.getAttribute("propertyID");
|
||||||
let property = properties[propertyID];
|
let property = properties[propertyID];
|
||||||
property.elInput = dt;
|
property.elInput = dt;
|
||||||
dt.addEventListener('change', createEmitTextPropertyUpdateFunction(property.name, property.isParticleProperty));
|
dt.addEventListener('change', createEmitTextPropertyUpdateFunction(property));
|
||||||
}
|
}
|
||||||
|
|
||||||
elDropdowns = document.getElementsByTagName("select");
|
elDropdowns = document.getElementsByTagName("select");
|
||||||
|
|
Loading…
Reference in a new issue