fix bad css merge, add particle property debounce

This commit is contained in:
David Back 2018-10-24 15:07:47 -07:00
parent 5c1972e3f4
commit a88678fb70
2 changed files with 19 additions and 3 deletions

View file

@ -1107,7 +1107,7 @@ body#entity-list-body {
position: relative; /* New positioning context. */
}
#search-area {
#filter-area {
padding-right: 168px;
padding-bottom: 24px;
}

View file

@ -1304,6 +1304,7 @@ const JSON_EDITOR_ROW_DIV_INDEX = 2;
var elGroups = {};
var properties = {};
var colorPickers = {};
var particlePropertyUpdates = {};
var selectedEntityProperties;
var lastEntityID = null;
@ -1534,9 +1535,23 @@ function updateProperty(originalPropertyName, propertyValue) {
} else {
propertyUpdate[originalPropertyName] = propertyValue;
}
updateProperties(propertyUpdate);
// queue up particle property changes with the debounced sync to avoid
// causing particle emitting to reset each frame when updating values
if (properties[originalPropertyName].isParticleProperty) {
Object.keys(propertyUpdate).forEach(function (propertyUpdateKey) {
particlePropertyUpdates[propertyUpdateKey] = propertyUpdate[propertyUpdateKey];
});
particleSyncDebounce();
} else {
updateProperties(propertyUpdate);
}
}
var particleSyncDebounce = _.debounce(function () {
updateProperties(particlePropertyUpdates);
particlePropertyUpdates = {};
}, DEBOUNCE_TIMEOUT);
function updateProperties(propertiesToUpdate) {
EventBridge.emitWebEvent(JSON.stringify({
id: lastEntityID,
@ -2717,7 +2732,8 @@ function loaded() {
let property = {
data: propertyData,
elementID: propertyElementID,
name: propertyName,
name: propertyName,
isParticleProperty: group.id.includes("particles"),
elProperty: elProperty
};
properties[propertyID] = property;