MCPcopy Create free account
hub / github.com/gre/gl-react / render

Method render

packages/gl-react-dom/src/GLViewDOM.tsx:131–171  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

129 }
130
131 render() {
132 const { error } = this.state;
133 let {
134 width,
135 height,
136 pixelRatio,
137 style,
138 debug,
139 version,
140 ...rest
141 } = this.props;
142 if (!pixelRatio)
143 pixelRatio = Number(
144 (typeof window === "object" && window.devicePixelRatio) || 1
145 );
146 for (let k in propTypes) {
147 if (rest.hasOwnProperty(k)) {
148 delete (rest as any)[k];
149 }
150 }
151 return (
152 <span
153 style={{
154 position: "relative",
155 ...style,
156 display: "inline-block",
157 width,
158 height,
159 }}
160 >
161 <canvas
162 ref={this.onRef}
163 style={{ width, height }}
164 width={width * pixelRatio}
165 height={height * pixelRatio}
166 {...rest}
167 />
168 {error ? <ErrorDebug error={error} /> : null}
169 </span>
170 );
171 }
172
173 _createContext() {
174 const { webglContextAttributes, debug, version } = this.props;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected