Converted ArcBall class to Scala.