Viewport
Last updated
Was this helpful?
Last updated
Was this helpful?
The viewport is the visible reading area. It is not to be confused with pagination and navigation.
The purpose of the viewport is to allow more flexibility in how and what are visible to the user while maintaining stable calculations internally. The pagination and navigation are two of the hardest things to get right in a reader and they need t have stable measures to do so. An extra layer as such allow decoupling the "view" from the "rendering".
For example, zooming out (thumbnails) or in is much easier when manipulating the viewport since you don't mess up with documents or the layout itself. You can imagine the viewport as a virtual layer that can be transformed without affecting the behavior of the engine.
The absolute viewport represent the dimensions given when creating the reader and is the dimension used internally for pagination, navigation and all the calculations. The relative viewport represent the viewing area after transformation are applied.
Some calculations will always use the absolute viewport (eg: navigation) to keep consistency and correct results while other behaviors might take advantage of the absolute viewport. For example, prose will always load documents that are visible on the relative viewport.