2021: fix viewport offset

1. fix viewport- linebox offset
2. refactor