Additional calculations added to detect how close to the centre of the viewport a piece is, and add/remove relevant classes