Browse Source

Fixed #893, #911: the `clickToUse` option of Network, Graph2d, and Network was blocking click events in the web page.

flowchartTest
jos 9 years ago
parent
commit
ba5cf07b08
7 changed files with 29316 additions and 29297 deletions
  1. +5
    -0
      HISTORY.md
  2. +29275
    -29267
      dist/vis.js
  3. +1
    -1
      dist/vis.map
  4. +1
    -1
      dist/vis.min.css
  5. +18
    -18
      dist/vis.min.js
  6. +15
    -9
      lib/shared/Activator.js
  7. +1
    -1
      package.json

+ 5
- 0
HISTORY.md View File

@ -3,6 +3,11 @@ http://visjs.org
## not-yet-released, version 4.1.1-SNAPSHOT ## not-yet-released, version 4.1.1-SNAPSHOT
### General
- Fixed #893, #911: the `clickToUse` option of Network, Graph2d, and Network
was blocking click events in the web page.
### Timeline ### Timeline
- Improved function `fit()` to take into account the actual width of items. - Improved function `fit()` to take into account the actual width of items.

+ 29275
- 29267
dist/vis.js
File diff suppressed because it is too large
View File


+ 1
- 1
dist/vis.map
File diff suppressed because it is too large
View File


+ 1
- 1
dist/vis.min.css
File diff suppressed because it is too large
View File


+ 18
- 18
dist/vis.min.js
File diff suppressed because it is too large
View File


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

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

+ 1
- 1
package.json View File

@ -34,7 +34,7 @@
"keycharm": "^0.2.0", "keycharm": "^0.2.0",
"uuid": "^2.0.1", "uuid": "^2.0.1",
"moment": "^2.10.2", "moment": "^2.10.2",
"propagating-hammerjs": "^1.4.1"
"propagating-hammerjs": "^1.4.2"
}, },
"devDependencies": { "devDependencies": {
"babel": "^5.1.11", "babel": "^5.1.11",

Loading…
Cancel
Save