joseph / Monocle

A silky, tactile browser-based ebook JavaScript library.
http://monocle.inventivelabs.com.au
MIT License
743 stars 200 forks source link

Fix pagination for Chrome 22+ when zooming #161

Closed eunomie closed 3 years ago

eunomie commented 11 years ago

Hi,

When using zoom in/out in chrome 22+ with sub-pixel rendering, pages can be cut on the left or right. A first try to fix it can be found here : https://github.com/joseph/Monocle/pull/146

This is a new version reducing DOM access by computed webkit scale value only when value is updated (updating zoom fire a window resize event).

I find the code a little dirty because of the addition of a specific value for one engine but I don't how how you handle those cases.

joseph commented 11 years ago

Hi @CrEv and @nono, firstly, thanks again for your contribution, and apologies for not getting onto it promptly. I was hacking on this today, because I thought it might factor in the CSS zoom attribute too. Certainly, when you set body { zoom: 2; } on a document containing a Monocle reader, there will be weird pagination results, but this approach doesn't help there.

I went looking for the component cut-off effect you're both describing in latest Chrome on OSX and Windows, and I couldn't see it. If you know how to reproduce it, and you're willing to test the chrome-zoom branch I just pushed, that would be huge.

I'm going to leave this PR open and close the other one. Thanks again.

joseph commented 11 years ago

FYI in that experimental chrome-zoom branch, I changed the zoom detection function because the old one stopped working in Chrome. See discussion here: https://github.com/tombigel/detect-zoom/issues/37