|
|
@ -21,20 +21,19 @@ function Activator(container) { |
|
|
|
}; |
|
|
|
|
|
|
|
this.dom.overlay = document.createElement('div'); |
|
|
|
this.dom.overlay.className = 'overlay'; |
|
|
|
this.dom.overlay.className = 'vis-overlay'; |
|
|
|
|
|
|
|
this.dom.container.appendChild(this.dom.overlay); |
|
|
|
|
|
|
|
this.hammer = Hammer(this.dom.overlay, {prevent_default: false}); |
|
|
|
this.hammer = Hammer(this.dom.overlay); |
|
|
|
this.hammer.on('tap', this._onTapOverlay.bind(this)); |
|
|
|
|
|
|
|
// block all touch events (except tap)
|
|
|
|
var me = this; |
|
|
|
var events = [ |
|
|
|
'touch', 'pinch', |
|
|
|
'doubletap', 'hold', |
|
|
|
'dragstart', 'drag', 'dragend', |
|
|
|
'mousewheel', 'DOMMouseScroll' // DOMMouseScroll is needed for Firefox
|
|
|
|
'tap', 'doubletap', 'press', |
|
|
|
'pinch', |
|
|
|
'pan', 'panstart', 'panmove', 'panend' |
|
|
|
]; |
|
|
|
events.forEach(function (event) { |
|
|
|
me.hammer.on(event, function (event) { |
|
|
@ -43,8 +42,8 @@ function Activator(container) { |
|
|
|
}); |
|
|
|
|
|
|
|
// attach a tap event to the window, in order to deactivate when clicking outside the timeline
|
|
|
|
this.windowHammer = Hammer(window, {prevent_default: false}); |
|
|
|
this.windowHammer.on('tap', function (event) { |
|
|
|
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(); |
|
|
@ -77,7 +76,7 @@ Activator.prototype.destroy = function () { |
|
|
|
|
|
|
|
// cleanup hammer instances
|
|
|
|
this.hammer = null; |
|
|
|
this.windowHammer = null; |
|
|
|
this.bodyHammer = null; |
|
|
|
// FIXME: cleaning up hammer instances doesn't work (Timeline not removed from memory)
|
|
|
|
}; |
|
|
|
|
|
|
|