mikebolt / ThreeTwist

ThreeTwist is a JavaScript library for simulating, visualizing, and interacting with 3D twisty puzzles.
MIT License
3 stars 0 forks source link

Fix partial rotation bug #6

Open mikebolt opened 8 years ago

mikebolt commented 8 years ago

When you call, for example, cube.twist('F15'), then perform another twist, sometimes you get this error:

Uncaught TypeError: Cannot read property 'getRotation' of undefined

Here's the context:

var slice  = this.slicesDictionary[ twist.command ],
      rotation = twist.degrees,
      radians  = rotation.degreesToRadians(),
      duration = Math.abs( radians - slice.getRotation() ) /
        ( Math.PI * 0.5 ) * this.twistDuration;

It might be a good idea to disallow partial twists if they pose serious problems for other parts of the code.