|
@ -41,14 +41,15 @@ function Activator(container) { |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
// attach a tap event to the window, in order to deactivate when clicking outside the timeline
|
|
|
|
|
|
this.bodyHammer = Hammer(document && document.body, {prevent_default: false}); |
|
|
|
|
|
this.bodyHammer.on('tap', function (event) { |
|
|
|
|
|
// deactivate when clicked outside the container
|
|
|
|
|
|
if (!_hasParent(event.target, container)) { |
|
|
|
|
|
me.deactivate(); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
// attach a click event to the window, in order to deactivate when clicking outside the timeline
|
|
|
|
|
|
if (document && document.body) { |
|
|
|
|
|
this.onClick = function (event) { |
|
|
|
|
|
if (!_hasParent(event.target, container)) { |
|
|
|
|
|
me.deactivate(); |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
document.body.addEventListener('click', this.onClick); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (this.keycharm !== undefined) { |
|
|
if (this.keycharm !== undefined) { |
|
|
this.keycharm.destroy(); |
|
|
this.keycharm.destroy(); |
|
@ -74,9 +75,14 @@ Activator.prototype.destroy = function () { |
|
|
// remove dom
|
|
|
// remove dom
|
|
|
this.dom.overlay.parentNode.removeChild(this.dom.overlay); |
|
|
this.dom.overlay.parentNode.removeChild(this.dom.overlay); |
|
|
|
|
|
|
|
|
|
|
|
// remove global event listener
|
|
|
|
|
|
if (this.onClick) { |
|
|
|
|
|
document.body.removeEventListener('click', this.onClick); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// cleanup hammer instances
|
|
|
// cleanup hammer instances
|
|
|
|
|
|
this.hammer.destroy(); |
|
|
this.hammer = null; |
|
|
this.hammer = null; |
|
|
this.bodyHammer = null; |
|
|
|
|
|
// FIXME: cleaning up hammer instances doesn't work (Timeline not removed from memory)
|
|
|
// FIXME: cleaning up hammer instances doesn't work (Timeline not removed from memory)
|
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|