Browse Source

improved upon popups

v3_develop
Alex de Mulder 9 years ago
parent
commit
8f15b3ba41
2 changed files with 3552 additions and 3537 deletions
  1. +3528
    -3520
      dist/vis.js
  2. +24
    -17
      lib/network/Network.js

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


+ 24
- 17
lib/network/Network.js View File

@ -1355,7 +1355,7 @@ Network.prototype._onMouseWheel = function(event) {
Network.prototype._onMouseMoveTitle = function (event) {
var gesture = hammerUtil.fakeGesture(this, event);
var pointer = this._getPointer(gesture.center);
var popupVisible = false;
// check if the previously selected node is still selected
if (this.popup !== undefined) {
@ -1365,7 +1365,8 @@ Network.prototype._onMouseMoveTitle = function (event) {
// if the popup was not hidden above
if (this.popup.hidden === false) {
this.popup.setPosition(pointer.x + 3,pointer.y - 3)
popupVisible = true;
this.popup.setPosition(pointer.x + 3,pointer.y - 5)
this.popup.show();
}
}
@ -1375,20 +1376,20 @@ Network.prototype._onMouseMoveTitle = function (event) {
this.frame.focus();
}
// start a timeout that will check if the mouse is positioned above
// an element
var me = this;
var checkShow = function() {
me._checkShowPopup(pointer);
};
if (this.popupTimer) {
clearInterval(this.popupTimer); // stop any running calculationTimer
}
if (!this.drag.dragging) {
this.popupTimer = setTimeout(checkShow, this.constants.tooltip.delay);
// start a timeout that will check if the mouse is positioned above an element
if (popupVisible === false) {
var me = this;
var checkShow = function () {
me._checkShowPopup(pointer);
};
if (this.popupTimer) {
clearInterval(this.popupTimer); // stop any running calculationTimer
}
if (!this.drag.dragging) {
this.popupTimer = setTimeout(checkShow, this.constants.tooltip.delay);
}
}
/**
* Adding hover highlights
*/
@ -1501,7 +1502,7 @@ Network.prototype._checkShowPopup = function (pointer) {
// adjust a small offset such that the mouse cursor is located in the
// bottom left location of the popup, and you can easily move over the
// popup area
this.popup.setPosition(pointer.x + 3, pointer.y - 3);
this.popup.setPosition(pointer.x + 3, pointer.y - 5);
this.popup.setText(this.popupObj.getTitle());
this.popup.show();
}
@ -1530,10 +1531,16 @@ Network.prototype._checkHidePopup = function (pointer) {
var stillOnObj = false;
if (this.popup.popupTargetType == 'node') {
stillOnObj = this.nodes[this.popup.popupTargetId].isOverlappingWith(pointerObj)
stillOnObj = this.nodes[this.popup.popupTargetId].isOverlappingWith(pointerObj);
if (stillOnObj === true) {
var overNode = this._getNodeAt(pointer);
stillOnObj = overNode.id == this.popup.popupTargetId;
}
}
else {
stillOnObj = this.edges[this.popup.popupTargetId].isOverlappingWith(pointerObj)
if (this._getNodeAt(pointer) === null) {
stillOnObj = this.edges[this.popup.popupTargetId].isOverlappingWith(pointerObj);
}
}

Loading…
Cancel
Save