gdkraus / color-contrast-chrome

Color Contrast Analyzer Extension for Google Chrome
Other
19 stars 15 forks source link

Capture Page Region is ignoring devicePixelRatio #2

Open jonsquared opened 8 years ago

jonsquared commented 8 years ago

When capturing a page region, the devicePixelRatio is being ignored. For example, on a retina display (devicePixelRatio == 2), the captured region bounds are exactly half the correct width, half the correct height, and positioned at half the correct x/y coordinates. Most browsers expose devicePixelRatio as a standard property of the window so this information should be easily determined.

This devicePixelRatio problem also manifests when rendering the other capture method results. It will display the processed image at twice the correct size (when devicePixelRatio is 2).

jmuheim commented 8 years ago

I have the same problem. Is there any news on that?

scottneish commented 5 years ago

Following up on this issue - this is a super useful plugin but becomes practically unusable when testing on my Macbook. Any possibility of a fix?

leefloyd commented 5 years ago

I agree that the plugin only works as expected when I have a 1x density display connected. The fix does seem as simple as multiplying screen measurements by the devicePixelRatio (e.g. document.documentElement.clientWidth * window.devicePixelRatio instead of document.documentElement.clientWidth), but I admit that I have never created an extension before.

If someone were to submit a pull request, would you handle it and push it out to Chrome Web Store, @gdkraus? If you do not intend to continue maintaining this extension, could you recommend a replacement?