mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 12:18:36 +02:00
debugging js
This commit is contained in:
parent
de5fcccc7b
commit
2f0877dc0f
2 changed files with 24 additions and 4 deletions
|
@ -61,6 +61,7 @@ function HifiEntityUI(parent) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
this.webBridgeSync = _.debounce(function (id, val) {
|
this.webBridgeSync = _.debounce(function (id, val) {
|
||||||
|
console.log(id + " " + val + " " + self.webBridgeSync);
|
||||||
if (self.EventBridge) {
|
if (self.EventBridge) {
|
||||||
var sendPackage = {};
|
var sendPackage = {};
|
||||||
sendPackage[id] = val;
|
sendPackage[id] = val;
|
||||||
|
@ -256,10 +257,10 @@ HifiEntityUI.prototype = {
|
||||||
if (!currentProperties.radiusFinish) {
|
if (!currentProperties.radiusFinish) {
|
||||||
currentProperties.radiusFinish = currentProperties.particleRadius;
|
currentProperties.radiusFinish = currentProperties.particleRadius;
|
||||||
}
|
}
|
||||||
if (!currentProperties.colorStart.red) {
|
if (!currentProperties.colorStart || !currentProperties.colorStart.red) {
|
||||||
currentProperties.colorStart = currentProperties.color;
|
currentProperties.colorStart = currentProperties.color;
|
||||||
}
|
}
|
||||||
if (!currentProperties.colorFinish.red) {
|
if (!currentProperties.colorFinish || !currentProperties.colorFinish.red) {
|
||||||
currentProperties.colorFinish = currentProperties.color;
|
currentProperties.colorFinish = currentProperties.color;
|
||||||
}
|
}
|
||||||
self.fillFields(currentProperties);
|
self.fillFields(currentProperties);
|
||||||
|
@ -573,7 +574,7 @@ HifiEntityUI.prototype = {
|
||||||
inputField.onchange = inputField.oninput;
|
inputField.onchange = inputField.oninput;
|
||||||
slider.oninput = function (event) {
|
slider.oninput = function (event) {
|
||||||
inputField.value = event.target.value;
|
inputField.value = event.target.value;
|
||||||
self.webBridgeSync(group.id, slider.value);
|
self.webBridgeSync(group.id, inputField.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
inputField.id = group.id;
|
inputField.id = group.id;
|
||||||
|
@ -598,7 +599,7 @@ HifiEntityUI.prototype = {
|
||||||
} else {
|
} else {
|
||||||
inputField.value = Math.ceil(event.target.value);
|
inputField.value = Math.ceil(event.target.value);
|
||||||
}
|
}
|
||||||
self.webBridgeSync(group.id, slider.value * RADIANS_PER_DEGREE);
|
self.webBridgeSync(group.id, inputField.value * RADIANS_PER_DEGREE);
|
||||||
};
|
};
|
||||||
var degrees = document.createElement("label");
|
var degrees = document.createElement("label");
|
||||||
degrees.innerHTML = "°";
|
degrees.innerHTML = "°";
|
||||||
|
|
|
@ -54,11 +54,30 @@ ParticleExplorerTool = function() {
|
||||||
Entities.editEntity(that.activeParticleEntity, data.updatedSettings);
|
Entities.editEntity(that.activeParticleEntity, data.updatedSettings);
|
||||||
|
|
||||||
for (var key in data.updatedSettings) {
|
for (var key in data.updatedSettings) {
|
||||||
|
print(key + " " + that.activeParticleProperties.hasOwnProperty(key) + " " + data.updatedSettings[key])
|
||||||
if (that.activeParticleProperties.hasOwnProperty(key)) {
|
if (that.activeParticleProperties.hasOwnProperty(key)) {
|
||||||
that.activeParticleProperties[key] = data.updatedSettings[key];
|
that.activeParticleProperties[key] = data.updatedSettings[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var optionalProps = ["alphaStart", "alphaFinish", "radiusStart", "radiusFinish", "colorStart", "colorFinish"];
|
||||||
|
var fallbackProps = ["alpha", "particleRadius", "color"];
|
||||||
|
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)]];
|
||||||
|
needsUpdate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (needsUpdate) {
|
||||||
|
sendActiveParticleProperties();
|
||||||
|
}
|
||||||
|
|
||||||
} else if (data.messageType === "page_loaded") {
|
} else if (data.messageType === "page_loaded") {
|
||||||
sendActiveParticleProperties();
|
sendActiveParticleProperties();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue