From c9da1b15755c5bb993f05da35ab3a1a003183360 Mon Sep 17 00:00:00 2001 From: jos Date: Mon, 20 Apr 2015 13:28:50 +0200 Subject: [PATCH] Fixed clickToUse --- lib/shared/Activator.js | 17 ++++++++--------- lib/timeline/component/css/itemset.css | 9 +++++++++ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/lib/shared/Activator.js b/lib/shared/Activator.js index 97be894b..f4b04ff1 100644 --- a/lib/shared/Activator.js +++ b/lib/shared/Activator.js @@ -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) }; diff --git a/lib/timeline/component/css/itemset.css b/lib/timeline/component/css/itemset.css index 82276f4b..45af6a30 100644 --- a/lib/timeline/component/css/itemset.css +++ b/lib/timeline/component/css/itemset.css @@ -32,3 +32,12 @@ .vis-foreground .vis-group:last-child { border-bottom: none; } + +.vis-overlay { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 10; +} \ No newline at end of file