fixed inViewport calculations