Commit bfcfa5cf authored by S Anand's avatar S Anand

ENH: $.doodle().trigger('stop', [true]) moves doodle to end and stops

parent 839fb0db
......@@ -27,14 +27,20 @@ $.fn.doodle = function(options) {
// Turn off any other doodling on these paths
.off('stop.g.doodle start.g.doodle')
// And re-define the events
.on('stop.g.doodle', function() {
.on('stop.g.doodle', function(e, finish) {
if (finish) {
// Move to the end
start_pos = 1
tick()
} else {
// Store the current pos as start_pos to allow resuming
start_pos = pos
}
// Cancel ticks as well as loop
if (request_id)
request_id = global.cancelAnimationFrame(request_id)
if (timeout_id)
timeout_id = global.clearTimeout(timeout_id)
// Store the current pos as start_pos to allow resuming
start_pos = pos
})
.on('start.g.doodle', function(e, pos) {
if (request_id)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment