Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the zoom always return true #23

Open
kmvan opened this issue Apr 19, 2016 · 6 comments
Open

Fix the zoom always return true #23

kmvan opened this issue Apr 19, 2016 · 6 comments

Comments

@kmvan
Copy link

kmvan commented Apr 19, 2016

const widthThreshold = window.outerWidth - window.innerWidth * window.devicePixelRatio > threshold
const heightThreshold = window.outerHeight - window.innerHeight * window.devicePixelRatio > threshold

//yes, just add `* window.devicePixelRatio`
@sindresorhus
Copy link
Owner

Can you elaborate?

@kmvan
Copy link
Author

kmvan commented Apr 19, 2016

yes.
Tested in chrome.
If the resolution is 1920*1080, the outerWidth is 1920.
If the zoom is 100%, the innerWidth is 1920/1 = 1920.
If the zoom is 150%, the innerWidth is 1920/1.5 = 1280.
...
So, just make the innerWidth "set" to 1:1 range, the bug fixed.

@sindresorhus
Copy link
Owner

Ok, cool. Can you do a pull request?

@kmvan
Copy link
Author

kmvan commented May 5, 2016

You add it, I'm lazy :)

@kmvan kmvan closed this as completed May 5, 2016
@SamVerschueren SamVerschueren reopened this May 5, 2016
@samyk
Copy link
Contributor

samyk commented Oct 17, 2016

While this prevents zooming causing false positive, it seems to prevent the detection from working at all. Tested in Chrome 54.0.2840.59 beta.

@samyk
Copy link
Contributor

samyk commented Oct 17, 2016

Resolved a different way in #27 (with caveat that zooming while inspector is open produces false negative)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants