Browse Source

fix edit button sometimes not opening inspector

Darragh Burke 5 years ago
parent
commit
782eb3241b

+ 5 - 4
inspector/src/components/actionTabs/tabs/propertyGrids/materials/texturePropertyGridComponent.tsx

@@ -75,6 +75,7 @@ export class TexturePropertyGridComponent extends React.Component<ITextureProper
         
         this.onOpenTextureEditor.bind(this);
         this.onCloseTextureEditor.bind(this);
+        this.openTextureEditor.bind(this);
     }
 
     componentWillUnmount() {
@@ -112,8 +113,8 @@ export class TexturePropertyGridComponent extends React.Component<ITextureProper
     }
 
     openTextureEditor() {
-        if (this.state.isTextureEditorOpen && this.state.textureEditing !== this.props.texture) {
-            this.onCloseTextureEditor(null, () => this.openTextureEditor());
+        if (this.state.isTextureEditorOpen) {
+            this.onCloseTextureEditor(() => this.openTextureEditor());
             return;
         }
         this.setState({
@@ -124,7 +125,7 @@ export class TexturePropertyGridComponent extends React.Component<ITextureProper
 
     onOpenTextureEditor(window: Window) {}
     
-    onCloseTextureEditor(window: Window | null, callback?: {() : void}) {
+    onCloseTextureEditor(callback?: {() : void}) {
         this.setState({
             isTextureEditorOpen: false,
             textureEditing: null
@@ -188,7 +189,7 @@ export class TexturePropertyGridComponent extends React.Component<ITextureProper
                   title='Texture Inspector'
                   size={this._textureInspectorSize}
                   onOpen={this.onOpenTextureEditor}
-                  onClose={this.onCloseTextureEditor}
+                  onClose={() => this.onCloseTextureEditor}
                   ref={this.popoutWindowRef}
                 >
                     <TextureEditorComponent

+ 1 - 4
inspector/src/components/actionTabs/tabs/propertyGrids/materials/textures/textureCanvasComponent.tsx

@@ -8,10 +8,7 @@ interface ITextureCanvasComponentProps {
     texture: BaseTexture;
 }
 
-export class TextureCanvasComponent extends React.PureComponent<ITextureCanvasComponentProps> {
-    shouldComponentUpdate(nextProps : ITextureCanvasComponentProps) {
-        return (nextProps.texture !== this.props.texture);
-    }
+export class TextureCanvasComponent extends React.Component<ITextureCanvasComponentProps> {
 
     render() {
         return <div>