Procházet zdrojové kódy

Merge pull request #7691 from belfortk/nme-popout-preview-background-color-bug

update RGB values for default bg color
David Catuhe před 5 roky
rodič
revize
837f19958f

+ 7 - 2
nodeEditor/src/components/preview/previewAreaComponent.tsx

@@ -2,6 +2,7 @@
 import * as React from "react";
 import { GlobalState } from '../../globalState';
 import { DataStorage } from '../../dataStorage';
+import { Nullable, Observer } from 'babylonjs';
 
 const doubleSided: string = require("./svgs/doubleSided.svg");
 const depthPass: string = require("./svgs/depthPass.svg");
@@ -15,13 +16,17 @@ interface IPreviewAreaComponentProps {
 }
 
 export class PreviewAreaComponent extends React.Component<IPreviewAreaComponentProps, {isLoading: boolean}> {
+    private _onIsLoadingChangedObserver: Nullable<Observer<boolean>>;
 
     constructor(props: IPreviewAreaComponentProps) {
         super(props);
-
         this.state = {isLoading: true};
 
-        this.props.globalState.onIsLoadingChanged.add(state => this.setState({isLoading: state}));
+        this._onIsLoadingChangedObserver = this.props.globalState.onIsLoadingChanged.add((state) => this.setState({isLoading: state}));
+    }
+
+    componentWillUnmount() {
+        this.props.globalState.onIsLoadingChanged.remove(this._onIsLoadingChangedObserver);
     }
 
     changeBackFaceCulling(value: boolean) {        

+ 3 - 3
nodeEditor/src/globalState.ts

@@ -63,9 +63,9 @@ export class GlobalState {
         this.directionalLight1 = DataStorage.ReadBoolean("DirectionalLight1", false);
         this.controlCamera = DataStorage.ReadBoolean("ControlCamera", true);
 
-        let r = DataStorage.ReadNumber("BackgroundColorR", 32);
-        let g = DataStorage.ReadNumber("BackgroundColorG", 25);
-        let b = DataStorage.ReadNumber("BackgroundColorB", 64);
+        let r = DataStorage.ReadNumber("BackgroundColorR", 0.12549019607843137);
+        let g = DataStorage.ReadNumber("BackgroundColorG", 0.09803921568627451);
+        let b = DataStorage.ReadNumber("BackgroundColorB", 0.25098039215686274);
         this.backgroundColor = new Color4(r, g, b, 1.0);
     }
 }