try using getRenderedRange instead of getViewport