소스 검색

mol-plugin: warn if viewport canvas changes ref

David Sehnal 6 년 전
부모
커밋
a445e4c590
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      src/mol-plugin/ui/viewport.tsx

+ 4 - 1
src/mol-plugin/ui/viewport.tsx

@@ -124,7 +124,10 @@ export class Viewport extends PluginComponent<{ }, ViewportState> {
 
         return <div className='msp-viewport'>
             <div className='msp-viewport-host3d' ref={elm => this.container = elm}>
-                <canvas ref={elm => this.canvas = elm}></canvas>
+                <canvas ref={elm => {
+                    if (!!this.canvas && this.canvas !== elm) console.warn('changed viewport canvas')
+                    this.canvas = elm
+                }} />
             </div>
         </div>;
     }