|
@ -130,7 +130,7 @@ function Network (container, data, options) { |
|
|
altLength: undefined |
|
|
altLength: undefined |
|
|
}, |
|
|
}, |
|
|
inheritColor: "from", // to, from, false, true (== from)
|
|
|
inheritColor: "from", // to, from, false, true (== from)
|
|
|
useGradients: false |
|
|
|
|
|
|
|
|
useGradients: false // release in 4.0
|
|
|
}, |
|
|
}, |
|
|
configurePhysics:false, |
|
|
configurePhysics:false, |
|
|
physics: { |
|
|
physics: { |
|
@ -1356,9 +1356,18 @@ Network.prototype._onMouseMoveTitle = function (event) { |
|
|
var gesture = hammerUtil.fakeGesture(this, event); |
|
|
var gesture = hammerUtil.fakeGesture(this, event); |
|
|
var pointer = this._getPointer(gesture.center); |
|
|
var pointer = this._getPointer(gesture.center); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check if the previously selected node is still selected
|
|
|
// check if the previously selected node is still selected
|
|
|
if (this.popupObj) { |
|
|
|
|
|
this._checkHidePopup(pointer); |
|
|
|
|
|
|
|
|
if (this.popup !== undefined) { |
|
|
|
|
|
if (this.popup.hidden === false) { |
|
|
|
|
|
this._checkHidePopup(pointer); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// if the popup was not hidden above
|
|
|
|
|
|
if (this.popup.hidden === false) { |
|
|
|
|
|
this.popup.setPosition(pointer.x + 3,pointer.y - 3) |
|
|
|
|
|
this.popup.show(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// if we bind the keyboard to the div, we have to highlight it to use it. This highlights it on mouse over
|
|
|
// if we bind the keyboard to the div, we have to highlight it to use it. This highlights it on mouse over
|
|
@ -1431,8 +1440,9 @@ Network.prototype._checkShowPopup = function (pointer) { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var id; |
|
|
var id; |
|
|
var lastPopupNode = this.popupObj; |
|
|
|
|
|
|
|
|
var previousPopupObjId = this.popupObj === undefined ? "" : this.popupObj.id; |
|
|
var nodeUnderCursor = false; |
|
|
var nodeUnderCursor = false; |
|
|
|
|
|
var popupType = "node"; |
|
|
|
|
|
|
|
|
if (this.popupObj == undefined) { |
|
|
if (this.popupObj == undefined) { |
|
|
// search the nodes for overlap, select the top one in case of multiple nodes
|
|
|
// search the nodes for overlap, select the top one in case of multiple nodes
|
|
@ -1474,23 +1484,26 @@ Network.prototype._checkShowPopup = function (pointer) { |
|
|
|
|
|
|
|
|
if (overlappingEdges.length > 0) { |
|
|
if (overlappingEdges.length > 0) { |
|
|
this.popupObj = this.edges[overlappingEdges[overlappingEdges.length - 1]]; |
|
|
this.popupObj = this.edges[overlappingEdges[overlappingEdges.length - 1]]; |
|
|
|
|
|
popupType = "edge"; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (this.popupObj) { |
|
|
if (this.popupObj) { |
|
|
// show popup message window
|
|
|
// show popup message window
|
|
|
if (this.popupObj != lastPopupNode) { |
|
|
|
|
|
var me = this; |
|
|
|
|
|
if (!me.popup) { |
|
|
|
|
|
me.popup = new Popup(me.frame, me.constants.tooltip); |
|
|
|
|
|
|
|
|
if (this.popupObj.id != previousPopupObjId) { |
|
|
|
|
|
if (this.popup === undefined) { |
|
|
|
|
|
this.popup = new Popup(this.frame, this.constants.tooltip); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.popup.popupTargetType = popupType; |
|
|
|
|
|
this.popup.popupTargetId = this.popupObj.id; |
|
|
|
|
|
|
|
|
// adjust a small offset such that the mouse cursor is located in the
|
|
|
// 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
|
|
|
// bottom left location of the popup, and you can easily move over the
|
|
|
// popup area
|
|
|
// popup area
|
|
|
me.popup.setPosition(pointer.x - 3, pointer.y - 3); |
|
|
|
|
|
me.popup.setText(me.popupObj.getTitle()); |
|
|
|
|
|
me.popup.show(); |
|
|
|
|
|
|
|
|
this.popup.setPosition(pointer.x + 3, pointer.y - 3); |
|
|
|
|
|
this.popup.setText(this.popupObj.getTitle()); |
|
|
|
|
|
this.popup.show(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
@ -1502,17 +1515,31 @@ Network.prototype._checkShowPopup = function (pointer) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Check if the popup must be hided, which is the case when the mouse is no |
|
|
|
|
|
|
|
|
* Check if the popup must be hidden, which is the case when the mouse is no |
|
|
* longer hovering on the object |
|
|
* longer hovering on the object |
|
|
* @param {{x:Number, y:Number}} pointer |
|
|
* @param {{x:Number, y:Number}} pointer |
|
|
* @private |
|
|
* @private |
|
|
*/ |
|
|
*/ |
|
|
Network.prototype._checkHidePopup = function (pointer) { |
|
|
Network.prototype._checkHidePopup = function (pointer) { |
|
|
if (!this.popupObj || !this._getNodeAt(pointer) ) { |
|
|
|
|
|
|
|
|
var pointerObj = { |
|
|
|
|
|
left: this._XconvertDOMtoCanvas(pointer.x), |
|
|
|
|
|
top: this._YconvertDOMtoCanvas(pointer.y), |
|
|
|
|
|
right: this._XconvertDOMtoCanvas(pointer.x), |
|
|
|
|
|
bottom: this._YconvertDOMtoCanvas(pointer.y) |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var stillOnObj = false; |
|
|
|
|
|
if (this.popup.popupTargetType == 'node') { |
|
|
|
|
|
stillOnObj = this.nodes[this.popup.popupTargetId].isOverlappingWith(pointerObj) |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
stillOnObj = this.edges[this.popup.popupTargetId].isOverlappingWith(pointerObj) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (stillOnObj === false) { |
|
|
this.popupObj = undefined; |
|
|
this.popupObj = undefined; |
|
|
if (this.popup) { |
|
|
|
|
|
this.popup.hide(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
this.popup.hide(); |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|