diff --git a/scripts/system/html/js/entityProperties.js b/scripts/system/html/js/entityProperties.js index 66dcecc83e..5c63e6dd99 100644 --- a/scripts/system/html/js/entityProperties.js +++ b/scripts/system/html/js/entityProperties.js @@ -2151,7 +2151,6 @@ function createColorProperty(property, elProperty) { submit: false, // We don't want to have a submission button onShow: function(colpick) { console.log("Showing"); - $(colorPickerID).attr('active', 'true'); // The original color preview within the picker needs to be updated on show because // prior to the picker being shown we don't have access to the selections' starting color. colorPickers[colorPickerID].colpickSetColor({ @@ -2159,13 +2158,17 @@ function createColorProperty(property, elProperty) { "g": elNumberG.elInput.value, "b": elNumberB.elInput.value }); + + $(colorPickerID).attr('active', 'true'); }, onHide: function(colpick) { $(colorPickerID).attr('active', 'false'); }, onChange: function(hsb, hex, rgb, el) { $(el).css('background-color', '#' + hex); - emitColorPropertyUpdate(propertyName, rgb.r, rgb.g, rgb.b); + if ($(colorPickerID).attr('active') === 'true') { + emitColorPropertyUpdate(propertyName, rgb.r, rgb.g, rgb.b); + } } }); @@ -3351,6 +3354,16 @@ function loaded() { property.elColorPicker.style.backgroundColor = "rgb(" + propertyValue.red + "," + propertyValue.green + "," + propertyValue.blue + ")"; + if ($(property.elColorPicker).attr('active') === 'true') { + $(property.elColorPicker).attr('active', 'false'); + colorPickers['#' + property.elementID].colpickSetColor({ + "r": propertyValue.red, + "g": propertyValue.green, + "b": propertyValue.blue + }); + $(property.elColorPicker).attr('active', 'true'); + } + property.elNumberR.setValue(propertyValue.red); property.elNumberG.setValue(propertyValue.green); property.elNumberB.setValue(propertyValue.blue);