Max density mode #4

Closed
logicking opened this Issue Feb 1, 2012 · 3 comments

3 participants

@logicking

Hi there!

Why full density mode is no longer supported in v2.0? On android devices the width is 533 instead of 800 pixels and on iPhone4 480 instead of 960.

It was very useful feature and now it's gone completely without any explanation.

Have to revert to older version.

P.S. Viewporter is great tool. Thank you very much for making it opensource.

@pbakaus
Owner

Hi,

thanks for the comment! In fact, the new way to handle viewports is a lot less error prone than the old version, which is why I chose compatibility over this seldom used feature.

However, I am planning to see if I can bring it back in a follow up version. In the meantime, I encourage you to stick with version 1, until I have made these changes.

Thanks,
Paul

@cookiengineer

What you can do:

if (window.devicePixelRatio > 1) {
var width = window.innerWidth * window.devicePixelRatio; // same for height
}

For example, if you are rendering via canvas, you will have to set the canvas.width to the "higher" value to render with the higher resolution. Set the canvas.style.width to the lower value. This would be like (pseudo-code):

canvas.style.width = window.innerWidth + 'px';
canvas.width = window.innerWidth * window.devicePixelRatio;

~Chris

@pbakaus pbakaus closed this Feb 3, 2012
@pbakaus
Owner

Here we go, reimplemented in a new demo. This should do the job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment