W3C home > Mailing lists > Public > public-css-archive@w3.org > October 2020

Re: [csswg-drafts] [cssom-view] No way to access the viewport size without losing precision. (#5260)

From: Mr.doob via GitHub <sysbot+gh@w3.org>
Date: Thu, 08 Oct 2020 18:39:27 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-705752010-1602182366-sysbot+gh@w3.org>
Another workaround seems to be this:

```js
const dpr = window.devicePixelRatio;
const width = Math.floor( window.innerWidth * dpr ) / dpr;
const height = Math.floor( window.innerHeight * dpr ) / dpr;
```

But I vote for turning these into doubles too.

-- 
GitHub Notification of comment by mrdoob
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5260#issuecomment-705752010 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 8 October 2020 18:39:29 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:20 UTC