Fixed flickering and simplified calculations

- Removed offending line causing a flicker to the default top state
- Simplified calculation of the top offset when in the bottom state
Merge pull request #12862 from sultano/patch-1

Fixed flickering and simplified calculations