Skip to content

Commit c01b6d9

Browse files
committed
fix(View): Make canvas DPI aware
1 parent 010dd4e commit c01b6d9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/core/View.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,11 @@ export default class View extends Component {
323323
onResize() {
324324
const container = this.containerRef.current;
325325
if (container) {
326+
const devicePixelRatio = window.devicePixelRatio || 1;
326327
const { width, height } = container.getBoundingClientRect();
327-
this.openglRenderWindow.setSize(
328-
Math.max(width, 10),
329-
Math.max(height, 10)
330-
);
328+
const w = Math.floor(width * devicePixelRatio);
329+
const h = Math.floor(height * devicePixelRatio);
330+
this.openglRenderWindow.setSize(Math.max(w, 10), Math.max(h, 10));
331331
this.renderWindow.render();
332332
}
333333
}

0 commit comments

Comments
 (0)