paper.checkViewport()
For every view in the paper, determine if it fits into the viewport specified by paper.options.viewport
function. Views that fit (views for which that function returns true
) are attached to the DOM; views that do not are detached.
While async
papers do this automatically, synchronous papers require an explicit call to this method for this functionality to be applied. To show all views again, use paper.dumpViews()
.
paper.checkViewport(opt)
If opt.viewport
is provided, it is used as the callback function instead of paper.options.viewport
. The format of the callback method is described in the option's documentation, as are examples of usage.
In async
papers, providing opt.viewport
causes viewport to be temporarily recalculated according to the provided callback function. This may be useful in situations where you need to show different views depending on context (e.g. viewing a section of the diagram vs. printing all of it).