Improvements to horizontal viewport check

* Right was calculated incorrectly (but was never used), which has been fixed.
* The horizontal viewport check took the absolute value of the element's left,
  which didn't accurately check the viewport left/element right bound. This has
  been modified to check the element's left against the viewport's right
  (whether the element is within the right side of the viewport) and the
  element's right against the viewport's left (whether the element is within
  the left side of the viewport).