mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:35:08 +02:00
remove logging, play with debounce times
This commit is contained in:
parent
ae19f16c3d
commit
223350b7be
2 changed files with 11 additions and 15 deletions
|
@ -44,6 +44,7 @@ and If there is any changes to either the Entities or properties of
|
|||
**/
|
||||
|
||||
var RADIANS_PER_DEGREE = Math.PI / 180;
|
||||
var DEBOUNCE_TIMEOUT = 125;
|
||||
|
||||
var roundFloat = function (input, round) {
|
||||
round = round ? round : 1000;
|
||||
|
@ -58,17 +59,16 @@ var roundFloat = function (input, round) {
|
|||
|
||||
function HifiEntityUI(parent) {
|
||||
this.parent = parent;
|
||||
console.log("Creating a new Entity UI instance!");
|
||||
|
||||
var self = this;
|
||||
this.settingsUpdateLock = false;
|
||||
this.webBridgeSync = _.debounce(function (id, val) {
|
||||
if (self.EventBridge && !self.settingsUpdateLock) {
|
||||
console.log(id + " " + val + " " + self.webBridgeSync);
|
||||
var sendPackage = {};
|
||||
sendPackage[id] = val;
|
||||
self.submitChanges(sendPackage);
|
||||
}
|
||||
}, 125);
|
||||
}, DEBOUNCE_TIMEOUT);
|
||||
}
|
||||
|
||||
HifiEntityUI.prototype = {
|
||||
|
@ -159,7 +159,6 @@ HifiEntityUI.prototype = {
|
|||
var self = this;
|
||||
var fields = document.getElementsByTagName("input");
|
||||
|
||||
console.log("Locking Settings Update while filling input Fields.");
|
||||
self.settingsUpdateLock = true;
|
||||
if (!currentProperties.locked) {
|
||||
for (var i = 0; i < fields.length; i++) {
|
||||
|
@ -238,9 +237,8 @@ HifiEntityUI.prototype = {
|
|||
}
|
||||
// Now unlocking settings Update lock for sending messages on callbacks.
|
||||
setTimeout(function () {
|
||||
console.log("Unlocking UI");
|
||||
self.settingsUpdateLock = false;
|
||||
}, 50);
|
||||
}, DEBOUNCE_TIMEOUT * 2.5);
|
||||
},
|
||||
connect: function (EventBridge) {
|
||||
this.EventBridge = EventBridge;
|
||||
|
@ -276,7 +274,6 @@ HifiEntityUI.prototype = {
|
|||
if (!currentProperties.colorFinish || !currentProperties.colorFinish.red) {
|
||||
currentProperties.colorFinish = currentProperties.color;
|
||||
}
|
||||
console.log("Got ScriptEvent particle_settings", data);
|
||||
self.fillFields(currentProperties);
|
||||
// Do expected property match with structure;
|
||||
} else if (data.messageType === 'particle_close') {
|
||||
|
@ -285,7 +282,6 @@ HifiEntityUI.prototype = {
|
|||
});
|
||||
},
|
||||
build: function () {
|
||||
console.log("Building UI Anew");
|
||||
var self = this;
|
||||
var sections = Object.keys(this.structure);
|
||||
this.builtRows = {};
|
||||
|
@ -541,7 +537,7 @@ HifiEntityUI.prototype = {
|
|||
textureImage.classList.remove("no-preview");
|
||||
textureImage.classList.add("no-texture");
|
||||
}
|
||||
}, 250);
|
||||
}, DEBOUNCE_TIMEOUT * 2);
|
||||
|
||||
textureUrl.oninput = function (event) {
|
||||
// Add throttle
|
||||
|
@ -728,4 +724,4 @@ HifiEntityUI.prototype = {
|
|||
}
|
||||
return row;
|
||||
}
|
||||
};
|
||||
};
|
|
@ -54,7 +54,6 @@ ParticleExplorerTool = function() {
|
|||
Entities.editEntity(that.activeParticleEntity, data.updatedSettings);
|
||||
|
||||
for (var key in data.updatedSettings) {
|
||||
print(key + " " + that.activeParticleProperties.hasOwnProperty(key) + " " + data.updatedSettings[key])
|
||||
if (that.activeParticleProperties.hasOwnProperty(key)) {
|
||||
that.activeParticleProperties[key] = data.updatedSettings[key];
|
||||
}
|
||||
|
@ -65,10 +64,11 @@ ParticleExplorerTool = function() {
|
|||
var entityProps = Entities.getEntityProperties(that.activeParticleProperties, optionalProps);
|
||||
var needsUpdate = false;
|
||||
for (var i = 0; i < optionalProps.length; i++) {
|
||||
if (data.updatedSettings[fallbackProps[Math.floor(i / 2)]]) {
|
||||
var prop = optionalProps[i * 2];
|
||||
if (!that.activeParticleProperties[prop] || !that.activeParticleProperties[prop].red) {
|
||||
that.activeParticleProperties[prop] = entityProps[fallbackProps[Math.floor(i / 2)]];
|
||||
var fallback = fallbackProps[Math.floor(i / 2)];
|
||||
if (data.updatedSettings[fallback]) {
|
||||
var prop = optionalProps[i];
|
||||
if (!that.activeParticleProperties[prop] || (fallback === "color" && !that.activeParticleProperties[prop].red)) {
|
||||
that.activeParticleProperties[prop] = entityProps[fallback];
|
||||
needsUpdate = true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue