Ver Fonte

added missing react component state intitialization

Alexander Rose há 6 anos atrás
pai
commit
02705f691b

+ 6 - 0
src/mol-app/ui/controls/slider.tsx

@@ -206,6 +206,12 @@ export class SliderBase extends React.Component<SliderBaseProps, SliderBaseState
     private sliderElement: HTMLElement | undefined = void 0;
     private handleElements: (HTMLElement | undefined)[] = [];
 
+    state: SliderBaseState = {
+        handle: null,
+        recent: 0,
+        bounds: [0, 0],
+    };
+
     constructor(props: SliderBaseProps) {
         super(props);
 

+ 6 - 0
src/mol-app/ui/visualization/image-canvas.tsx

@@ -22,6 +22,12 @@ export class ImageCanvas extends React.Component<{ imageData: ImageData, aspectR
     private canvas: HTMLCanvasElement | null = null;
     private ctx: CanvasRenderingContext2D | null = null;
 
+    state = {
+        imageData: new ImageData(1, 1),
+        width: 1,
+        height: 1
+    }
+
     updateStateFromProps() {
         this.setState({
             imageData: this.props.imageData,