Pārlūkot izejas kodu

Merge pull request #8806 from BabylonJS/msDestiny14/nme

Bug Fix: UI Not Updating on ColorPicker
David Catuhe 5 gadi atpakaļ
vecāks
revīzija
80673c414a

+ 7 - 1
nodeEditor/src/sharedComponents/colorPickerComponent.tsx

@@ -59,10 +59,16 @@ export class ColorPickerLineComponent extends React.Component<IColorPickerCompon
     }
 
     shouldComponentUpdate(nextProps: IColorPickerComponentProps, nextState: IColorPickerComponentState) {
-        return nextProps.value.toHexString() !== this.props.value.toHexString() 
+        let result = nextProps.value.toHexString() !== this.props.value.toHexString() 
             || nextProps.disableAlpha !== this.props.disableAlpha 
             || nextState.hex !== this.state.hex
             || nextState.pickerEnabled !== this.state.pickerEnabled;
+        
+        if(result) {
+            nextState.color = nextProps.value;
+            nextState.hex = nextProps.value.toHexString();
+        }
+        return result;   
     }
 
     componentDidUpdate() {