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 #146

Closed nono closed 11 years ago

nono commented 11 years ago

Hi,

when using Monocle on Chrome 22+ (with sub-pixel rendering) and zooming (in or out), the pages can be cut on the left or right when we advance far in a component.This commit can be the start of a fix for this issue.

joseph commented 11 years ago

pageDimensions gets called quite a lot. Adding stuff to the DOM, styling it and removing it each time is a bit nasty. Can we look at being kinder on the DOM? If it only affects WebKit, perhaps we should fence it in a WebKit-only conditional too?

nono commented 11 years ago

Can we look at being kinder on the DOM?

Yes, do you have any idea about that? Computing this value only one time and hoping the user won't change his zoom level after that?

If it only affects WebKit, perhaps we should fence it in a WebKit-only conditional too?

Yes, I didn't look at src/compat/env.js and thought that Monocle.Browser.env.roundPageDimensions was only for WebKit. But it's not the case, so I should modify that.

nono commented 11 years ago

By the way, zooming on firefox 16 works better when I don't do the rounding.

eunomie commented 11 years ago

What about using the resize event to compute the zoom level only when changed ?

joseph commented 11 years ago

Closed because see comments on #161. Thanks.