| 100 | cancelFrame, |
| 101 | }: SurfaceOpts): any => { |
| 102 | return class Surface extends Component< |
| 103 | SurfaceProps, |
| 104 | { |
| 105 | ready: boolean; |
| 106 | rebootId: number; |
| 107 | debug: boolean; |
| 108 | } |
| 109 | > { |
| 110 | id: number = ++surfaceId; |
| 111 | gl: WebGLRenderingContext | null = null; |
| 112 | buffer!: WebGLBuffer; |
| 113 | loaderResolver: LoaderResolver | null = null; |
| 114 | glView: any; |
| 115 | root: Node | null = null; |
| 116 | shaders: { [key: string]: Shader } = {}; |
| 117 | _preparingGL: Array<any> = []; |
| 118 | _needsRedraw: boolean = false; |
| 119 | state = { |
| 120 | ready: false, |
| 121 | rebootId: 0, |
| 122 | debug: false, |
| 123 | }; |
| 124 | |
| 125 | RenderLessElement = RenderLessElement; |
| 126 | mapRenderableContent = mapRenderableContent; |
| 127 | |
| 128 | static propTypes = SurfacePropTypes; |
| 129 | |
| 130 | componentDidMount() { |
| 131 | _instances.push(this); |
| 132 | this.getVisitors().forEach((v) => v.onSurfaceMount(this as any)); |
| 133 | } |
| 134 | |
| 135 | componentWillUnmount() { |
| 136 | this._stopLoop(); |
| 137 | this._destroyGL(); |
| 138 | const i = _instances.indexOf(this); |
| 139 | if (i !== -1) _instances.splice(i, 1); |
| 140 | this.getVisitors().forEach((v) => v.onSurfaceUnmount(this as any)); |
| 141 | } |
| 142 | |
| 143 | componentDidUpdate() { |
| 144 | this.redraw(); |
| 145 | } |
| 146 | |
| 147 | render() { |
| 148 | const { |
| 149 | props, |
| 150 | state: { ready, rebootId, debug }, |
| 151 | } = this; |
| 152 | const { children, style } = props; |
| 153 | |
| 154 | // We allow to pass-in all props we don't know so you can hook to DOM events. |
| 155 | const rest: any = {}; |
| 156 | Object.keys(props).forEach((key) => { |
| 157 | if (allSurfaceProps.indexOf(key) === -1) { |
| 158 | rest[key] = (props as any)[key]; |
| 159 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…