klokantech / iiifviewer

[DEPRECATED] IIIF WebGL / Canvas / DOM mobile-ready fast viewer powered by OpenLayers V3
http://klokantech.github.io/iiifviewer/
Other
54 stars 10 forks source link

Retina support #12

Closed klokan closed 8 years ago

klokan commented 9 years ago

Displaying of the image content on Retina displays.

petrsloup commented 8 years ago

Support of HiDPI displays seems to be possible without any problems (tested on iPad Air 2 and Android phone).

We can either detect devicePixelRatio > 1 and create "retina" tiles (@2x): var tilePixelRatio = (window.devicePixelRatio || 1) > 1 ? 2 : 1;

Or we can actually use the value to request precisely scaled tiles from the server: var tilePixelRatio = Math.min(window.devicePixelRatio || 1, 4); which would provide optimal visual experience since many devices have devicePixelRatio > 2. But this is probably not very cache-friendly.

Or we can round [up ?] to the nearest integer "scale level" -- 1, 2, 3, 4, ... (compromise between the two solutions).

@klokan Which approach do we want to implement?

klokan commented 8 years ago

A cache friendly alternative would be to have always equal 256x256 tiles requested from the server but displaying them with correct pixelRation on the client. You did not mention this right?

Let's try this - and as an option to "request precisely scaled tiles from the server". We may need both implemented...

Does this mean OL3 has been fixed - and we can fix also https://github.com/klokan/omo-mobile/issues/21?

petrsloup commented 8 years ago

Yes, that is probably the best approach -- the requested tiles are always the same, but the view resolutions are multiplied by the devicePixelRatio.

I don't actually have any device that suffered from the canvas size issue, so I'm not able to test this properly.

@klokan Testing version with HiDPI support is at http://rawgit.com/petrsloup/0d09714761fe2e73688b/raw/index.html. Please test it on some low-memory iOS devices.

petrsloup commented 8 years ago

Implemented in v1.1