Merge pull request #14707 from thoys/fix/create/activeColorPickerDoesNotUpdateOnEntitySwitch

fix for continuous color picker update loop
This commit is contained in:
Jeff Clinton 2019-01-25 10:38:14 -08:00 committed by GitHub
commit efb278b258
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3313,7 +3313,8 @@ function loaded() {
}
}
let doSelectElement = lastEntityID === '"' + selectedEntityProperties.id + '"';
let hasSelectedEntityChanged = lastEntityID !== '"' + selectedEntityProperties.id + '"';
let doSelectElement = !hasSelectedEntityChanged;
// the event bridge and json parsing handle our avatar id string differently.
lastEntityID = '"' + selectedEntityProperties.id + '"';
@ -3433,7 +3434,7 @@ function loaded() {
property.elColorPicker.style.backgroundColor = "rgb(" + propertyValue.red + "," +
propertyValue.green + "," +
propertyValue.blue + ")";
if ($(property.elColorPicker).attr('active') === 'true') {
if (hasSelectedEntityChanged && $(property.elColorPicker).attr('active') === 'true') {
// Set the color picker inactive before setting the color,
// otherwise an update will be sent directly after setting it here.
$(property.elColorPicker).attr('active', 'false');