Skip to content

Commit

Permalink
Merge pull request #3 from trinketapp/hard-stop
Browse files Browse the repository at this point in the history
Exposes a stop method to allow instances to stop rotation.
  • Loading branch information
eah13 authored Apr 28, 2017
2 parents bf3b457 + eff6fc6 commit 5510a55
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/traqball.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@
bindEvent(THIS.box, 'touchstart', startrotation);

THIS.evHandlers = [startrotation, rotate, finishrotation];

// expose stopSlide
THIS.stop = hardStop;
})();


Expand Down Expand Up @@ -339,6 +342,13 @@
}
}

function hardStop(done) {
stopSlide();
if (done) {
setTimeout(done, 100);
}
}

function stopSlide(){
cancelAnimFrame(slide);
cleanupMatrix();
Expand Down

0 comments on commit 5510a55

Please sign in to comment.