mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 08:14:48 +02:00
Fix setting colors in ParticleExplorer without having the particle entity disappear. Handles Hex strings as well as color arrays.
This commit is contained in:
parent
cd802a6549
commit
d47e8eb999
1 changed files with 10 additions and 0 deletions
|
@ -198,6 +198,16 @@ function createColorPicker(key) {
|
|||
settings[key] = colorArray;
|
||||
var controller = gui.addColor(settings, key);
|
||||
controller.onChange(function(value) {
|
||||
// Handle hex colors
|
||||
if(_.isString(value) && value[0] === '#') {
|
||||
const BASE_HEX = 16;
|
||||
var colorRegExResult = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(value);
|
||||
value = [
|
||||
parseInt(colorRegExResult[1], BASE_HEX),
|
||||
parseInt(colorRegExResult[2], BASE_HEX),
|
||||
parseInt(colorRegExResult[3], BASE_HEX)
|
||||
];
|
||||
}
|
||||
var obj = {};
|
||||
obj[key] = convertColorArrayToObject(value);
|
||||
writeVec3ToInterface(obj);
|
||||
|
|
Loading…
Reference in a new issue