|
@ -157,6 +157,8 @@ function ItemSet(body, options) { |
|
|
this.selection = []; // list with the ids of all selected nodes
|
|
|
this.selection = []; // list with the ids of all selected nodes
|
|
|
this.stackDirty = true; // if true, all items will be restacked on next redraw
|
|
|
this.stackDirty = true; // if true, all items will be restacked on next redraw
|
|
|
|
|
|
|
|
|
|
|
|
this.popup = null; |
|
|
|
|
|
|
|
|
this.touchParams = {}; // stores properties while dragging
|
|
|
this.touchParams = {}; // stores properties while dragging
|
|
|
this.groupTouchParams = {}; |
|
|
this.groupTouchParams = {}; |
|
|
// create the HTML DOM
|
|
|
// create the HTML DOM
|
|
@ -889,12 +891,6 @@ ItemSet.prototype.removeItem = function(id) { |
|
|
// remove by id here, it is possible that an item has no id defined
|
|
|
// remove by id here, it is possible that an item has no id defined
|
|
|
// itself, so better not delete by the item itself
|
|
|
// itself, so better not delete by the item itself
|
|
|
dataset.remove(id); |
|
|
dataset.remove(id); |
|
|
|
|
|
|
|
|
// Remove it's popup
|
|
|
|
|
|
if (itemObj.popup) { |
|
|
|
|
|
itemObj.popup.destroy(); |
|
|
|
|
|
itemObj.popup = null; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
@ -1899,17 +1895,26 @@ ItemSet.prototype._onMouseOver = function (event) { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (item.getTitle()) { |
|
|
|
|
|
if (item.popup == null) { |
|
|
|
|
|
item.setPopup(new Popup(this.body.dom.root, this.options.tooltip.overflowMethod || 'flip')); |
|
|
|
|
|
|
|
|
var title = item.getTitle(); |
|
|
|
|
|
if (title) { |
|
|
|
|
|
if (this.popup == null) { |
|
|
|
|
|
this.popup = new Popup(this.body.dom.root, |
|
|
|
|
|
this.options.tooltip.overflowMethod || 'flip'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.popup.setText(title); |
|
|
var container = this.body.dom.centerContainer; |
|
|
var container = this.body.dom.centerContainer; |
|
|
item.popup.setPosition( |
|
|
|
|
|
|
|
|
this.popup.setPosition( |
|
|
event.clientX - util.getAbsoluteLeft(container) + container.offsetLeft, |
|
|
event.clientX - util.getAbsoluteLeft(container) + container.offsetLeft, |
|
|
event.clientY - util.getAbsoluteTop(container) + container.offsetTop |
|
|
event.clientY - util.getAbsoluteTop(container) + container.offsetTop |
|
|
); |
|
|
); |
|
|
item.popup.show(); |
|
|
|
|
|
|
|
|
this.popup.show(); |
|
|
|
|
|
} else { |
|
|
|
|
|
// Hovering over item without a title, hide popup
|
|
|
|
|
|
// Needed instead of _just_ in _onMouseOut due to #2572
|
|
|
|
|
|
if (this.popup != null) { |
|
|
|
|
|
this.popup.hide(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
this.body.emitter.emit('itemover', { |
|
|
this.body.emitter.emit('itemover', { |
|
@ -1928,8 +1933,8 @@ ItemSet.prototype._onMouseOut = function (event) { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (item.popup != null) { |
|
|
|
|
|
item.popup.hide(); |
|
|
|
|
|
|
|
|
if (this.popup != null) { |
|
|
|
|
|
this.popup.hide(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
this.body.emitter.emit('itemout', { |
|
|
this.body.emitter.emit('itemout', { |
|
@ -1942,14 +1947,14 @@ ItemSet.prototype._onMouseMove = function (event) { |
|
|
if (!item) return; |
|
|
if (!item) return; |
|
|
|
|
|
|
|
|
if (this.options.tooltip.followMouse) { |
|
|
if (this.options.tooltip.followMouse) { |
|
|
if (item.popup) { |
|
|
|
|
|
if (!item.popup.hidden) { |
|
|
|
|
|
|
|
|
if (this.popup) { |
|
|
|
|
|
if (!this.popup.hidden) { |
|
|
var container = this.body.dom.centerContainer; |
|
|
var container = this.body.dom.centerContainer; |
|
|
item.popup.setPosition( |
|
|
|
|
|
|
|
|
this.popup.setPosition( |
|
|
event.clientX - util.getAbsoluteLeft(container) + container.offsetLeft, |
|
|
event.clientX - util.getAbsoluteLeft(container) + container.offsetLeft, |
|
|
event.clientY - util.getAbsoluteTop(container) + container.offsetTop |
|
|
event.clientY - util.getAbsoluteTop(container) + container.offsetTop |
|
|
); |
|
|
); |
|
|
item.popup.show(); // Redraw
|
|
|
|
|
|
|
|
|
this.popup.show(); // Redraw
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|