From eff6fc6a9eaa2db0ec24818e4693f94230f6b7c7 Mon Sep 17 00:00:00 2001 From: Brian Marks Date: Fri, 28 Apr 2017 19:33:57 +0000 Subject: [PATCH] Exposes a stop method to allow instances to stop rotation. --- src/traqball.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/traqball.js b/src/traqball.js index 6ea7474..25de36c 100644 --- a/src/traqball.js +++ b/src/traqball.js @@ -201,6 +201,9 @@ bindEvent(THIS.box, 'touchstart', startrotation); THIS.evHandlers = [startrotation, rotate, finishrotation]; + + // expose stopSlide + THIS.stop = hardStop; })(); @@ -339,6 +342,13 @@ } } + function hardStop(done) { + stopSlide(); + if (done) { + setTimeout(done, 100); + } + } + function stopSlide(){ cancelAnimFrame(slide); cleanupMatrix();