width and height taking into account devicePixelRatio

This commit is contained in:
artem 2024-01-13 12:34:00 +03:00
parent fc356b23d8
commit 7e10dcb05a
1 changed files with 4 additions and 2 deletions

View File

@ -35,8 +35,10 @@
function resize(canvasObj) {
canvasObj.style = null;
canvasObj.width = window.screen.width;
canvasObj.height = window.screen.height;
canvasObj.width = window.screen.width * window.devicePixelRatio;
canvasObj.height = window.screen.height * window.devicePixelRatio;
canvasObj.style.width = window.screen.width + "px";
canvasObj.style.height = window.screen.widheightth + "px";
}
</script>
</html>