recalculate scroll distance