Browse Source

Fixed clickToUse

flowchartTest
jos 9 years ago
parent
commit
c9da1b1575
2 changed files with 17 additions and 9 deletions
  1. +8
    -9
      lib/shared/Activator.js
  2. +9
    -0
      lib/timeline/component/css/itemset.css

+ 8
- 9
lib/shared/Activator.js View File

@ -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)
};

+ 9
- 0
lib/timeline/component/css/itemset.css View File

@ -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;
}

Loading…
Cancel
Save